问题
I have developed a Geofencing App, which is working mostly proper. But I have also users saying me, that the app is reporting repeatable entering and exiting of the zone even the device is not moving!
The app uses the latest Google Geofencing API with the transition types GEOFENCE_TRANSITION_ENTER and GEOFENCE_TRANSITION_EXIT with expiration NEVER_EXPIRE and ACCESS_FINE_LOCATION on. The users configured also a large radius with 2000 meters with no success. The locations are set to high accuracy.
But the transitions is jumping from exit to enter, even the device is on the table in the house and not moving.
How can I improve this in the app?
回答1:
Google geofences mainly use network points, which rely on wifi and cell towers, and are prone to varying levels of accuracy. This causes a lot of location point "jumps" that the geofence registers as enter and exit events. One way to prevent this, is to make a gps call on a transition event, to verify that the user did indeed leave. If the user left, send the notification, if not, reset the geofence with INITIAL_TRIGGER_EXIT
set in GeofencingRequest
.
来源:https://stackoverflow.com/questions/34617007/android-google-geofencing-transition-jumps-even-device-is-not-moving