1

I have a bluetooth device , I want to know how to obtain the method when connected Bluetooth device is out of range like code

//if bluetooth is Not in the range of connection {

}

Please give me some solution

huang
  • 89
  • 1
  • 3
  • 7

2 Answers2

1

To check whether a bluetooth device is connected or not you can use intent filters to listen to the ACTION_ACL_CONNECTED, ACTION_ACL_DISCONNECT_REQUESTED, and ACTION_ACL_DISCONNECTED broadcasts. For more details please check this post How to programmatically tell if a Bluetooth device is connected? (Android 2.2)

Community
  • 1
  • 1
Marcin S.
  • 11,161
  • 6
  • 50
  • 63
0

There is no internal method like DeviceNotInRange() {} hence you need to work it out by creating your customized method. You need to create a method that keep searching on a regular interval and when device is not in range, you can raise an Alert or sound for intimation.

Lucifer
  • 29,392
  • 25
  • 90
  • 143