1. Are you ready for the Galaxy S20? Here is everything we know so far!

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

Discussion in 'Android Development' started by raylight, Dec 1, 2020.

  1. raylight

    raylight Lurker
    Thread Starter

    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?
     



    1. Download the Forums for Android™ app!


      Download

       
  2. codesplice

    codesplice Elite Recognized Moderator
    Moderator

    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. :)
     
  3. raylight

    raylight Lurker
    Thread Starter

    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?
     
  4. codesplice

    codesplice Elite Recognized Moderator
    Moderator

    Yeah, as I understand it the user would still need to enable Bluetooth to enable BLE scanning.
     
Loading...

Share This Page

Loading...