目录

CLASS info
public class SettingsClient
Class for checking location-related settings.

Public Method Summary

Return typeMethod name
Task<LocationSettingsResponse>checkLocationSettings(LocationSettingsRequest locationSettingsRequest)

Public Methods

Method
public Task<LocationSettingsResponse> checkLocationSettings(LocationSettingsRequest locationSettingsRequest)

This API is used to check whether related location settings are available.

To use this API, you must first create a LocationSettingsRequest.Builder class and add all LocationRequest objects that will be used by your app.

LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder().addLocationRequest(mLocationRequest);

Call the checkLocationSettings method.

Task <LocationSettingsResponse> result = LocationServices.getSettingsClient(this).checkLocationSettings(builder.build());

The client can check the status code in the LocationSettingsResponse object to view the location settings. The client can also call getLocationSettingsStates() to obtain the current state of relevant location settings.

Parameters

Parameter nameParameter desc
locationSettingsRequestRequest object related to location settings

Return

typedesc
Task<LocationSettingsResponse>Task. You can add listeners using addOnSuccesslistener() and addOnFailureListener() to obtain the current method execution result. If the execution fails, the getStateCode() method of ApiException is used to obtain the result code. The result code 6 indicates failure. (Information can be provided to instruct users to modify location settings to solve the problem.)