Search code examples
androidgeolocationlocationhuawei-mobile-serviceshuawei-location-kit

HMS Location Kit, location updates working only if user select "Allow all the time"


i'm editing an Android application in order to use both GMS and HMS.

About Location Kit, i followed the docs and requested location updates, but task succeeds only when user give "Allow all the time" permission to location use.

In manifest i've added ACCESS_BACKGROUND_LOCATION too, even i don't need it, in order to check if something changed.

HMS Core have "Allow all the time" location permission. I also tested sample app (https://github.com/HMS-Core/hms-location-demo-android-studio), but it have the same problem.

When user selects "Allow only when in use", the requestLocationUpdates method fails with error code PERMISSION_DENIED (a.k.a. Insufficient permission, from the docs), whose solution, always from the docs, should be to verify permission configurations in the Manifest file.

I have to say, i'm testing on a Redmi Note 8T, so not a Huawei phone.

Someone could help?

Thanks.


Solution

  • Currently, the fused location and geofence functions can be used on non-Huawei phones.

    To use fused location on non-Huawei phones, ensure that HMS Core (APK) and your app have the permission to always obtain the device location.Otherwise, an error indicating insufficient permission will be reported.