0

I woould like to do a background scanning of beacons. But user's bluetooth will not be on always.If i switch on the bluetooth battery will also drain.

Can I detect beacons with out switching on bluetooth in android ?

  • 2
    I suppose you could take a picture of the area and try to spot something that looks like a beacon, but otherwise, how do you expect to detect a Bluetooth signal without turning on Bluetooth? Bluetooth LE is not a significant drain on the battery on newer model phones, so I think you are worrying too much about that. – Ken Y-N Aug 05 '15 at 06:57
  • I would like to have background service which will monitor beacons.But the most of the users usually switch of their bluetooth.How will my background service detect beacons in that case? – user3437594 Aug 05 '15 at 08:05
  • They won't. The idea behind Bluetooth is that it requires Bluetooth. Most modern smartphones ship with BT on by default though, and it's reset to on after software updates. – Wojtek Borowicz Aug 05 '15 at 11:36
  • Here is [a previous question on how to request Bluetooth](https://stackoverflow.com/questions/28411991/how-to-request-android-user-to-enable-bluetooth-through-a-click). BT is one of these services you cannot automatically turn on. Perhaps if your background service noticed it off you could [send a notification to the user](https://stackoverflow.com/questions/1207269/sending-a-notification-from-a-service-in-android)? – Ken Y-N Aug 05 '15 at 23:13

1 Answers1

3

You need Bluetooth turned on to detect beacons. But you can detect if Bluetooth is turned off and turn it on programmatically on Androud. Of course, it is best to ask the user's permission to do so while explaining the benefit.

The battery drain for Bluetooth being on with low duty scanning is relatively mild -- similar to cell standby. The Android Beacon Library does all of this by default. You can read more about its battery usage here.

davidgyoung
  • 63,876
  • 14
  • 121
  • 204