androidbluetooth-lowenergyibeaconbeaconestimote

How to Show Notifications when get close to Beacon even if the app is closed?


I have created a mini App that helps me playing with beacons.

-what i have done so far-

So until now, I have successfully connected my App to the beacon, made 2 texts, so when I'm in the app and get in the beacon's range, the texts are changing so I can see that, move 2m away or turning the beacon upside down so it simulates Out of range, and it will show the message that I'm not in the range anymore.

So far so good, I have also successfully made the app to show notifications when I get close to the beacon, and when I click the notification to open a second activity.

-the problem-

Now, I want to show a notification when I get in the beacon's range, and the app is closed (not in the background). And after, when I click on that Notification to open my app / open App Google Play's Page if not installed.

I have searched on the internet but I haven't found anything conclusive.

If you guys know anything, or have you accomplished this task, it would be great if you can help with it. If you need more info like, my activities code I can upload it, but I considered unimportant.

Thanks!


Solution

  • Two points:

    1. In order to make a phone react to a beacon without your app installed (e.g. to launch a PlayStore page) you need an app prei-nstalled on all phones that does this for you. The Google Play Services app used to do this through the Nearby feature, but it was discontinued in Nov. 2018 because of spam concerns. Since then this is no longer possible to do.

    2. If you do have your app installed it is a straightforward process to detect in the background and send notifications. The Android Beacon Library provides instructions here:. https://altbeacon.github.io/android-beacon-library/notifications.html