0

After getting a Nearby notification if I swipe away the notification, in order to get the same notification again I need to force the mobile phone to scan for the beacons again. Can turning OFF the Bluetooth and turning it ON again will work ? Does this Bluetooth OFF-ON can initiate the scanning of the beacons ?

It does seem to work. But the behavior is hard to understand and predict. After turning the Bluetooth ON again, sometimes the mobile detects all of the beacons within a minutes and shows all the notifications, sometime the mobile detect only one beacon and sometimes mobiles does not show any Nearby notification again.

How does turning Bluetooth OFF-ON affects the scanning the beacons ? Thanks.

2 Answers2

0

Unfortunately Nearby relies on closed-source code inside proprietary Google Play Services. Like similar iOS APIs but unlike open source Android APIs, the specific implementations are not well documented and are subject to change at any time by Google. Although turning bluetooth off and on may work now, it might not work with a different release of Google Play Services that could come at any time.

If you want to reverse engineer when Nearby does a bluetooth scan, you can look at system messages in LogCat and see when you get messages starting with something like this:

07-02 14:03:17.894 30720-30736/? D/BtGatt.GattService

which would indicate bluetooth scanning is active.

Possible events that may trigger bluetooth scanning are:

  • Bluetooth on/off
  • Screen on/off
  • Scheduled timers

Remember, however, that whatever you find from this investigation may change with the next release of Google Play Services.

davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • This list of possible triggers is more or less accurate, although there are other triggers. We try to balance visibility of notifications with battery consumption and other factors. – Brian Duff Jul 06 '17 at 07:59
0

We generally interpret swiping away as an indicator of temporary disinterest in a notification, so there's some backoff behavior that tries to prevent a beacon from spamming users with unwanted notifications.

It may help us to understand what you're trying to achieve, and we can suggest alternative ways. For instance, Notifications has a developer mode which changes the way we show notifications in cases where you're debugging or trying things out.

Brian Duff
  • 406
  • 3
  • 12
  • Thanks a lot Brain for the reply. Could you plz share more information abt all the possible beacons scanning triggers ? I have a very simple use case. I am developing a pwa, so once the end user access it, pushing further notifications should not be an issue. But to direct the user to my pwa I need to rely on the Nearby notification. How to make sure that the end user receives Nearby notification every time without much manual effort. The key challenges are the seemingly unpredictability and MIN priority of the notification. Sometimes it takes some effort and time to get the notification. – user7892337 Jul 06 '17 at 17:09
  • Sorry, we have too be sensitive to the possibility of spam, and as much as it might make sense for your usecase to always pop the notification back up after the user dismisses it, as you can probably imagine, this would be very irritating for general users if the notification were of a promotional nature. The most reliable way to always see a nearby item is to visit the Nearby UI (list view). Any nearby items will always show up here. – Brian Duff Jul 07 '17 at 14:30
  • Just to add to this - the notification should reliably appear after you turn the screen on, provided you didn't dismiss it last time you saw it. If you're seeing something different, let us know and we can dig into this more. – Brian Duff Jul 07 '17 at 14:32