Android LocationRequest上的API错误(谷歌地图API)
我在实现谷歌地图API时出错 整个源代码的一小部分:Android LocationRequest上的API错误(谷歌地图API),android,api,maps,Android,Api,Maps,我在实现谷歌地图API时出错 整个源代码的一小部分: private LocationRequest mLocationRequest; private GoogleApiClient mGoogleApiClient; mLocationRequest = new LocationRequest(); 错误: LocationRequest constructor is marked as internal and should not be accessed from apps. Thi
private LocationRequest mLocationRequest;
private GoogleApiClient mGoogleApiClient;
mLocationRequest = new LocationRequest();
错误:
LocationRequest constructor is marked as internal and should not be accessed from apps.
This API has been flagged with a restriction that has not been met.
Examples of API restrictions:
* Method can only be invoked by a subclass
* Method can only be accessed from within the same library (defined by the Gradle library group id)
* Method can only be accessed from tests.
You can add your own API restrictions with the @RestrictTo annotation.
我还查看了Google Maps API文档:
谢谢
-加-
我看到了类似的问题和答案。但是当我尝试创建LocationRequest create()
方法时,错误仍然存在
public static LocationRequest create() {
LocationRequest request = new LocationRequest();
return request;
}
private void startLocationService() {
mLocationRequest = new LocationRequest().create();
mLocationRequest.setInterval(INTERVAL);
mLocationRequest.setFastestInterval(FASTEST_INTERVAL);
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
mGoogleApiClient = new GoogleApiClient.Builder(getActivity()).addApi(LocationServices.API).addConnectionCallbacks(this).addOnConnectionFailedListener(this).build();
}
可能是重复的先生,看看这个是的,我看到了问题和答案。但是当我尝试创建
LocationRequest create()
方法时,错误仍然存在。