Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.
HUAWEI HMS Core
Documents from this version have been archived, and will not continue to be maintained. Please use the latest version.
| CLASS info |
| Public class LocationServices |
| Location service. It provides location-related instances for you to obtain the location access point. |
| Return type | Method name |
| static FusedLocationProviderClient | getFusedLocationProviderClient(Activity activity) |
| static FusedLocationProviderClient | getFusedLocationProviderClient(Context context) |
| static SettingsClient | getSettingsClient (Context context) |
| static SettingsClient | getSettingsClient (Activity activity) |
| Method |
| public static FusedLocationProviderClient getFusedLocationProviderClient(Activity activity) |
This API is used to create a new FusedLocationProviderClient instance, which is used in an activity. Notice: If the input parameter is of the Activity type and an error occurs when the FusedLocationProviderClient instance is used to call the location service API, the app displays the interaction UI to prompt the user to handle the error. For example, if HMS Core (APK) is not in a version required for the location service, the app displays the UI to prompt the user to update HMS Core (APK). |
Parameters
| Parameter name | Parameter desc |
| activity | Activity. |
Return
| type | desc |
| FusedLocationProviderClient | Main entry class for obtaining the location information. |
| Method |
| public static FusedLocationProviderClient getFusedLocationProviderClient(Context context) |
This API is used to create a new FusedLocationProviderClient instance, which is used in the context. Notice: If the input parameter is not of the Activity type and an error occurs when the FusedLocationProviderClient instance is used to call the location service API, the app only returns an error code but does not display the interaction UI to prompt the user to handle the error. For example, if HMS Core (APK) is not in a version required for the location service, the app returns the error code 907135003. In this case, the user needs to manually update HMS Core (APK). To show the update wizard, you are advised to pass a parameter of the Activity type instead of the Context type to create a Client instance. |
Parameters
| Parameter name | Parameter desc |
| context | Context. |
Return
| type | desc |
| FusedLocationProviderClient | Main entry class for obtaining the location information. |
| Method |
| public static SettingsClient getSettingsClient (Context context) |
This API is used to create a new SettingsClient instance, which is used in the context. Notice: If the input parameter is not of the Activity type and an error occurs when the SettingsClient instance is used to call the location service API, the app only returns an error code but does not display the interaction UI to prompt the user to handle the error. For example, if HMS Core (APK) is not in a version required for the location service, the app returns the error code 907135003. In this case, the user needs to manually update HMS Core (APK). To show the update wizard, you are advised to pass a parameter of the Activity type instead of the Context type to create a Client instance. |
Parameters
| Parameter name | Parameter desc |
| context | Context. |
Return
| type | desc |
| SettingsClient | Entry class for interacting with the location setting API. |
| Method |
| public static SettingsClient getSettingsClient (Activity activity) |
This API is used to create a new SettingsClient instance, which is used in an activity. Notice: If the input parameter is of the Activity type and an error occurs when the SettingsClient instance is used to call the location service API, the app displays the interaction UI to prompt the user to handle the error. For example, if HMS Core (APK) is not in a version required for the location service, the app displays the UI to prompt the user to update HMS Core (APK). |
Parameters
| Parameter name | Parameter desc |
| activity | Activity. |
Return
| type | desc |
| SettingsClient | Entry class for interacting with the location setting API. |
Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
Quick start
Helps you find desired resources with ease.