android - 从 Google API 客户端删除/禁用地理围栏

标签 android google-api-client geofencing android-geofence

我想知道从 Google API 客户端删除/禁用地理围栏的最佳做法是什么。我的第一个想法是在客户端内禁用地理围栏,但看起来我们只能删除所有地理围栏或向 API 客户端添加列表。

这是否意味着,如果我引用地理围栏列表,并且想要暂时禁用其中一个,我必须从本地地理围栏列表中删除该地理围栏,从 Google API 客户端中删除所有地理围栏,然后再次将此地理围栏列表添加到客户?

最佳答案

要删除地理围栏,只需调用 remove the geofence from GeofencingApi列表仅包含 1 项。

要临时禁用:将地理围栏参数存储在应用程序中的某个位置(例如在 sqlite 或共享首选项中),然后从 GeofencingApi 中删除它,并在需要时通过 addGeofences 恢复(重新启用)。 .

关于android - 从 Google API 客户端删除/禁用地理围栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28750396/

相关文章:

android - GoogleApiClient 的 enableAutoManage() 需要一个 fragment Activity ,但我有一个 Activity

android - 如何在 IntentService 中启动通知

android - MacOS 和 Android Studio - 无法在设备上安装生成的 apk(文件)

android - 为什么Android会更改具有相同id的EditTexts的值?

Android:RecyclerView onClick Listener 未获取

禁用/重新启动位置服务时自动删除 Android Geofence

android - 绘图项目 - 通过 API 将通知 Activity 链接到单个地理围栏

android - 应用程序中不显示菜单

google-api - 谷歌 API : object oauth2 is not a member of package com. google.api.services

android - Google Android Drive api 登录在已安装版本上失败