• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

What would be a good architecture for knowing when a user is inside a place?

raylight

Lurker
Dec 1, 2020
4
0
I'd like to create an Android app that detects when a person enters a specific place (it can be a shop or a different public place). I know how to create an Android app that gets the phone's geolocation both by using the GPS provider and the Network provider, but I wonder if basing my app only on geolocation would be a good direction to follow for the project... With this method, I could create a background service that gets the phone location every 5 minutes just so I can determine if the phone is within a range of geolocation. The problem I see with this method is that GPS location is not very precise inside closed places...

I also have the option of installing a different hardware that communicates with the phone when it arrives in the place, like a WiFi or Bluetooth device with a specific MAC address. Even though this method seems to be more stable, I'd rely on the phones having their WiFi or Bluetooth activated all the time, which is a bad thing.

I'd like suggestions on how to approach this problem... I see that Google knows the location I've been because it sends me messages when I go to a specific restaurant. Is there a way to replicate a system like that on my own app? What would be an architecture that allows me to know when a phone got inside a specific place without relying on turned on sensors on the phone?
 
Android provides a geofencing capability so that you don't have to build one from scratch:
https://developer.android.com/training/location/geofencing

That way, the built-in location services would notify your app when the user entered or exited the defined location. There is a limit of 100 geofences per app per user; if you're trying to detect when a user enters a store of a nationwide chain you'd probably want to first get their coarse location, use that to retrieve the stores within X miles, and set those as the geofences.

Alternatively, BLE beaconing is built for pretty much exactly this purpose.
https://en.wikipedia.org/wiki/Bluetooth_low_energy_beacon

Disclaimer: I'm not actually a developer so won't be able to provide you with any specific technical guidance. I just know what Android can and can't do. :)
 
Upvote 0
Thanks... I'll check the geofencing feature and play a little with it to see how it goes...

About the BLE solution... Besides the external device, I'd still rely on having the Bluetooth turned on on the phone to make it work, right? Or does Android allow me to scan nearby bluetooth BLE devices even when the Bluetooth is deactivated?
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones