right now I'm working on an app that heavily relies on Geofencing API. It works fine, however sometimes when I leave phone on my desk, I sometimes receive false-positive callbacks. Probably because I switch between 3G antennas or something.
My idea was to detect user movement. If user is not moving and I receive message that he left the area - I'll know its wrong. Unfortunately I can't rely on location services, because apparently LocationManager and Geofencing API are giving me weird data. Sometimes when I enter an area and trigger getLastLocation()
, it's few kilometers away. Sometimes when I'm notified about leaving the area... Location Services are informing me that I'm still where I should. So yea - can't really rely on that.
Is there some kind of callback, notification or whole library for receiving notification of some sorts that phone is moving? From accelerometer or gyroscope?
Yes, I could micro manage that, because my app already has a service... but I'd like to avoid heavy battery drainage.
The best way is to use google play services activity recognition
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.