小编cap*_*abe的帖子

“不推荐使用地理围栏API”

我应该用什么代替它?此外,我针对此地理围栏应用程序的目标是 Android 7.0。

private void addNewGeofence(GeofencingRequest request) {
    Log.i(TAG, "GEOFENCE: Adding new Geofence.");
    if (checkPermissions()){
        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
            // TODO: Consider calling
            //    ActivityCompat#requestPermissions
            // here to request the missing permissions, and then overriding
            //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
            //                                          int[] grantResults)
            // to handle the case where the user grants the permission. See the documentation
            // for ActivityCompat#requestPermissions for more details.
            return;
        }
        LocationServices.GeofencingApi.addGeofences(
                googleApiClient, request, createGeofencePendingIntent()).setResultCallback(this);
    }

}
Run Code Online (Sandbox Code Playgroud)

android android-geofence

3
推荐指数
1
解决办法
3299
查看次数

标签 统计

android ×1

android-geofence ×1