What's the best way of detecting when an Android device is in a certain location? I'm creating a device admin app that enforces certain policies when the device is in a certain premise, e.g. a certain office building, and in order to enforce the policies, I need to know where the device is, and the Device Administrator API does not have any geo-location/geo-fence APIs.
I can think of a few methods, but none are foolproof:
- Poll fine location (Wifi/GPS) - dependent on whether user has Wifi/GPS on. Impossible to enforce. Also, GPS doesn't work indoors and drains battery significantly.
- Poll course location(cell tower) - more reliable, but inaccurate.
- Place wifi routers around premises and detect when they are near - dependent of whether user has Wifi on.
What's the best way of detecting a device's location?
The only thing that meet your requirements are iBeacons or comparable devices.
That are blue tooth low energy beacons. Which are mounted on walls in the building.
They emit a beacon id and the distance to that device. You have to manage which beacon id is mounted at which place.
This technique was developed by Apple, so look how you can use that within android.
Outdoors GPS works best, you have to live with battery drain.
Cell Tower locationing you better forget, that has only about 1000m acuracy. Wlan locationing, too is of limited use.