On Fri, Mar 25, 2011 at 4:53 AM, ehpaul <[email protected]> wrote: > Hello, I am writing an android program that I need to know when a > bluetooth device (I know the Mac) is in range. The program also needs > to be aware when the device is not in range. Is there any way to do > this without establishing a connection? >
Not that I've seen from the Bluetooth API exposed to the user. I don't understand the underlying protocol horribly well, but you need to actually scan for the uuid using SDP, which requires a call to the API. > When the device is in range, I am able to call > BluetoothAdapter.getRemoteDevice and retrieve the friendly name. But > when I am not in range, it seems this information is cached. I was > thinking if I can use the friendly name as an indicator whether the > device is within range (i.e If friendly name is not null, then it's in > range). I am certain there is better way to do this. But it seems the > only way is to establishing a connection. > > I don't think there is a better way, at least with the current API. Unless by better way you mean a more elaborate synchronization mechanism or something like that. But yes, I think at least from the API exposed by the android system, you have to do polling. (I wanted to do what you described too, I think it's a common thing, but perhaps not the anticipated use of BT and / or the android API.) Kris -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

