HUAWEI Location Kit combines the GPS, Wi-Fi, and base station locations to help you quickly obtain precise user locations, build up global positioning capabilities, and reach a wide range of users around the globe. This section only provides a test sample for location update. For test samples of other capabilities, please refer to the API Reference.
Prerequisites:
1. The network connection is normal.
2. HMS Core (APK) and the Location Demo have been installed on the device.
3. The location permission has been enabled. To enable the location permission, go to Settings > Apps > Permissions.
4. The Access my location function has been enabled. To enable the function, perform the following steps:
a. Go to Settings > Security & privacy > location access.
b. Toggle the Access my location switch on.
Test procedures:
1. Open the Location Demo.
2. Tap requestLocationUpdates with callback.
3. Tap requestLocationUpdates with callback again.
4. To stop Location request, tap removeLocationUpdates with callback.
Expected result:
The request is successfully sent and the corresponding location information is obtained.
The request is successfully sent and the corresponding location information is obtained.
1. The network connection is normal.
2. HMS Core (APK) and the Location Demo have been installed on the device.
3. The location permission has been enabled. To enable the location permission, go to Settings > Apps > Permissions.
4. The Access my location function has been enabled. To enable the function, perform the following steps:
a. Go to Settings > Security & privacy > location access.
b. Toggle the Access my location switch on.
Test procedures:
1. Open the Location Demo.
2. Tap the getLastLocation button.
3. Tap the getLastLocation consecutively.
Expected result:
The coordinates or null is obtained each time the button is tapped. If the coordinates are returned, they indicate the longitude and latitude of the location of the phone. If null is returned, no location information is cached.