I am trying my beacons using a demo code on Android. However, the monitoring doesn't work unless I change the status of the Bluetooth (switch it off then on again) . What to do to change that.
I tried to play with the following block of code, but it didn't work:
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if (action.equals(BluetoothAdapter.ACTIONSTATECHANGED)) {
final int state = intent.getIntExtra(BluetoothAdapter.EXTRASTATE,
BluetoothAdapter.ERROR);
switch (state) {
case BluetoothAdapter.STATETURNING_OFF:
// When bluetooth is turning off, lets stop estimotes ranging
if (estimoteServiceIntent != null) {
context.stopService(estimoteServiceIntent);
estimoteServiceIntent = null;
}