Issue
While trying to implement SafetyNet, I've added this dependency:
implementation 'com.huawei.hms:safetydetect:6.3.0.301'
And also added the permission to AndroidManifest.xml
:
<uses-permission android:name="com.huawei.permission.SECURITY_DIAGNOSE"/>
But this somehow doesn't work as expected:
E/RootDetect: `isRoot` exception : Must have `com.huawei.permission.SECURITY_DIAGNOSE` permission.
Neither user `10200` nor current process has `com.huawei.permission.SECURITY_DIAGNOSE`.
Also below Apps & services
> Permissions
> View all permissions
, it is not listed - all the others are being merged. Are there any further conditions or is the permission possibly being stripped out while merging? The AGP version is 7.1.2.
The strange thing is, that I still get the error message, when commenting out the dependency.
Solution
Huawei Safety Detect Kit doesn't require below permission "SECURITYDIAGNOSE", instead it requires only for "INTERNET" AND "ACCESSWIFI_STATE". Pls refer to below URL for sample code example and guide.
uses-permission android:name="com.huawei.permission.SECURITY_DIAGNOSE
<uses-permission android:name="android.permission.INTERNET" />
<!-- Access WiFi State -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Answered By - Zinna
Answer Checked By - Marilyn (JavaFixing Volunteer)