Huawei Variant of Android SDK
About the Huawei Variant
Starting with SDK 7.1, the Zendrive SDK has a Huawei variant (ZendriveSDK-HMS
) to support better trip detection on Huawei devices. This variant was developed to work with devices that work on Huawei's proprietary Huawei Mobile Services
(HMS).
The variant comes in two modes:
One for newer Huawei devices that exclusively use HMS
One for older Huawei devices that may support both HMS and
Google Mobile Services
(GMS).
To understand whether you should use the default SDK or the Huawei variant, see below.
default
GMS
All devices with Google Mobile Services
Huawei
HMS
New Huawei devices without GMS
Huawei
Hybrid
Older Huawei devices that support both GMS and HMS
While the default SDK will work with any Huawei devices that support GMS, we recommend the Huawei-variant on hybrid mode for better trip detection.
Support for HMS is still under development. See Known Issues below. We appreciate your feedback on your integration experience and performance. Contact us at [email protected].
Integration Instructions
The HMS Variant uses the same methods and classes as the default SDK. Add the HMS variant to your project and then follow the rest of the process described in our Start with Android guide as normal.
1. In your module's build.gradle
file, add the following dependencies.
repositories {
jcenter()
maven { url 'http://developer.huawei.com/repo/'}
}
dependencies {
implementation 'com.zendrive.sdk.android:ZendriveSDK-HMS:10.0.3'
}
2. Specify lintOptions
to prevent extraneous lint errors, and specify packagingOptions
to prevent unnecessary files from being included in your application. Your file structure should look like the Complete Sample tab below.
android {
lintOptions {
// This is needed to avoid spurious lint errors from libthrift and log4j.
disable 'InvalidPackage'
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
3. Run gradle sync
.
Known Issues
Huawei Honor Devices
The HMS based trip detection will not be supported for Honor devices in SDK 7.1.
Huawei Enjoy Devices
The Huawei Enjoy 20 device has displayed issues with the Zendrive SDK. While users will be prompted to provide Activity permission, no warning or error is given if Activity updates are not received. Diagnostic tools, like Heartbeat, may not provide warnings about Activity updates. Therefore, trip detection may suffer latencies.
Missing Activity Recognition Permission
If the user has denied activity recognition permission to the application, the ACTIVITY_RECOGNITION_PERMISSION_DENIED
error is thrown.
For devices running Android Q and above, request Manifest.permission.ACTIVITY_RECOGNITION
.
For Huawei devices running Android P with EMUI >= 9.1.1, request "com.huawei.hms.permission.ACTIVITY_RECOGNITION"
.
Was this helpful?