Home > database >  (React Native) Huawei Location Kit - is there any way to know if network location services setting s
(React Native) Huawei Location Kit - is there any way to know if network location services setting s

Time:12-16

to make our apps working indoor to fetch location we need Network Location Services switch to be on

enter image description here

And we're using this function to detect any setting that still off enter image description here

We noticed the response which is LocationSettingsStates, when the switch on or off is always true

enter image description here

Am I using wrong function to detect it??

CodePudding user response:

The class and methods mentioned in the original post are the right ones to be used for checking network location service availability.

Please refer to a partial code extracted from Huawei sample code obtained from enter image description here

CodePudding user response:

In some phone, LocationSettings interface may not be able to get the exact state.

You can set the Priority to be PRIORITY_BALANCED_POWER_ACCURACY and use requestLocationUpdatesWithCallback interface to get location update.

If the network location is not enabled, you will get the error code NETWORK_LOCATION_SERVICES_DISABLED 10105.

Then it means the switch is not enabled.

  • Related