0
我试图实现Google Play服务位置API以在我的APP中使用本地化。无法解析方法getLocationSettingsStates()
protected void createLocationRequest() {
// Create an instance of GoogleAPIClient.
if (mGoogleApiClient == null) {
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
}
LocationRequest mLocationRequest = new LocationRequest();
mLocationRequest.setInterval(10000);
mLocationRequest.setFastestInterval(5000);
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder()
.addLocationRequest(mLocationRequest);
PendingResult<LocationSettingsResult> result = LocationServices.SettingsApi.checkLocationSettings(mGoogleApiClient, builder.build());
final LocationSettingsStates states = result.getLocationSettingsStates();
}
我想已经导入所有所需的库,反正AndroidStudio通知“无法解析法getLocationSettingsStates()”。 我没有得到其他错误。 我不明白这一点。