在 android 中获取地理围栏唯一 ID 并将实体添加到地理围栏

Getting Geofence Unique id and adding entities to Geofence in android

我使用 "Google Api V2" 使用 GoogleLocationService.GeofeningApi 在 android 中创建了地理围栏。 因为,要添加具有任何特定地理围栏的实体,我们必须需要创建地理围栏的唯一 ID。但是在 android google api-V2 中,我无法为我创建的地理围栏生成 "unique id",根据 https://developers.google.com/maps/documentation/tracks/geofences 如何获取 Geofence 唯一 ID 以及如何使用 google api V2.

添加带有 Geofence 的实体

你说的是什么意思

I am unable to get the "unique id"

作为开发者,您有责任提供 "unique id" 那么问题出在哪里呢?您所要做的就是:每次创建一个 goefence 时都会增加一些数字变量,将其添加到 Geofence.Builder 并为下一个 geofence 存储该数字。