其他分享
首页 > 其他分享> > Android Update Geofences

Android Update Geofences

作者:互联网

Android中更新地理围栏的最佳方法是什么?是先删除旧的Geofences集合,然后像这样添加新更新的列表:

            LocationServices.GeofencingApi.removeGeofences(
                    mGoogleApiClient,
                    getGeofencePendingIntent()
            ).setResultCallback(this);

            LocationServices.GeofencingApi.addGeofences(
                    mGoogleApiClient,
                    getGeofencingRequest(),
                    getGeofencePendingIntent()
            ).setResultCallback(this); // Result processed in onResult().

或者我可以直接调用addGeofences而不删除旧的,并让新的替换旧的?

解决方法:

如果您首先阅读本手册,您会注意到addGeofences说:

If an existing geofence with the same request ID is already registered, the old geofence is replaced by the new one, and the new PendingIntent is used to generate intents for alerts.

标签:geofencing,android-geofence,android
来源: https://codeday.me/bug/20190824/1710802.html