Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android LocationRequest上的API错误(谷歌地图API)_Android_Api_Maps - Fatal编程技术网

Android LocationRequest上的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

我在实现谷歌地图API时出错

整个源代码的一小部分:

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()
方法时,错误仍然存在。