I'm trying to determine location via bluetooth beacons and while I can
discover and find all of the devices around me, when I try to grab the
EXTRA_RSSI that's supposed to come through it doesn't work. Here's
the code I'm using and I get a 0 every time.
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(ScannerActivity.this, "In BroadcastReceiver", 3);
String action = intent.getAction();
// When discovery finds a device
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
// Get the BluetoothDevice object from the Intent
BluetoothDevice device = intent.getParcelableExtra
(BluetoothDevice.EXTRA_DEVICE);
int rssi = intent.getIntExtra
(BluetoothDevice.EXTRA_RSSI, 0);
// Add the name and address to an array adapter to
show in a ListView
if (device.getBondState() !=
BluetoothDevice.BOND_BONDED) {
//do something
}
}
}
}
--
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