ML Kit provides two SDK integration modes: full SDK and base SDK. You can select either one based on your needs. For details, please refer to Full SDK and base SDK in Overview.
In this mode, you need to integrate the base SDK and then the algorithm package required by your app. The following table describes the algorithm package.
| Package Type | Package Name | SDK Size | Storage Position |
|---|---|---|---|
| Language detection algorithm package | ml-computer-language-detection-model | 5.4M | com.huawei.hms:ml-computer-language-detection-model:2.0.0.303 |
The following is the sample code for integration in full SDK mode:
- dependencies{
- // Import the base SDK.
- implementation 'com.huawei.hms:ml-computer-language-detection:2.0.0.303'
- // Import the language detection algorithm package.
- implementation 'com.huawei.hms:ml-computer-language-detection-model:2.0.0.303'
- }
The sample code is as follows:
- dependencies{
- implementation 'com.huawei.hms:ml-computer-language-detection:2.0.0.303'
- }
After integrating the SDK, add the following configuration to the file header:
- apply plugin: 'com.huawei.agconnect'
Add the configuration following the configuration item below:
- apply plugin: 'com.android.application'
Add the following statements to theAndroidManifest.xmlfile. After a user installs your app from HUAWEI AppGallery, the machine learning model is automatically updated to the user's device.
- <manifest
- ...
- <meta-data
- android:name="com.huawei.hms.ml.DEPENDENCY"
- android:value= "langdetect"/>
- ...
- </manifest>