Android: Build Polygonal Shape Geofence

后端 未结 2 843
暗喜
暗喜 2020-12-03 16:04

According to the API documentation, only Circular shape Geofences allowed:

https://developers.google.com/android/reference/com/google/android/gms/location/Geofence.B

2条回答
  •  遥遥无期
    2020-12-03 16:44

    You have to do it by yourself (however I think it's rather senseless - geofences/location services are inaccurate enough to not even be able to alert about circles, don't even think about some other concrete shape).

    Create smallest circular geofence which contains your polygon and if triggered just check if you are in the polygon inside with Google Maps Android API utility library.

    In other words check if you are in white area not in grey:

提交回复
热议问题