Detecting when bluetooth is off

I have a question about the estimote SDK. We are building our app using evothings’ phonegap plugin and everything seems to be working fine. However, the issues we are trying to figure out is with how to deal when blue tooth is off.

When we startup our application on iOS and bluetooth is off, the appropriate dialog box comes up and asks for permission to turn blue tooth on. However, we are not seeing the same behavior on android. If the bluetooth is off, we do not see this permission dialog box and the application simply starts up- we just don;t see any beacons. However, your estimate app and demo app bring up that dialog box.

Is this an issue with the phonegap plugin or the SDK? What do we need to do to get the same behavior from our app on android?

Appreciate your help.

Waqar Sadiq

iOS will automatically pop up the Bluetooth dialog when the app is trying to access BT, but it’s currently disabled. No additional coding required.

Android however doesn’t do that—you need to program such behavior yourself. We do exactly that in our Android Demos:

You should be able to take this code and write something similar using PhoneGap. I’m not sure if Evothings’ plugin exposes the isBluetoothEnabled method of our BeaconManager, but if it doesn’t, you can probably still find some other Bluetooth LE PhoneGap plugin to detect if BT is on or off and react accordingly. I did a very quick search and found this: for example: