Get UUID of local low energy bluetooth device in Android -
i'm trying access uuid of low energy bluetooth devices in android, post string web api.
here's code works fine @ toasting local name , mac address:
private final broadcastreceiver actionfoundreceiver = new broadcastreceiver(){ @override public void onreceive(context context, intent intent) { string action = intent.getaction(); if(bluetoothdevice.action_found.equals(action)) { bluetoothdevice device = intent.getparcelableextra(bluetoothdevice.extra_device); string smac = device.getaddress(); string sname = device.getname(); string suuid = ""; //help! toast toast = toast.maketext(getapplicationcontext(), "mac: " + smac + " - name: " + sname + " - uuid: " + suuid, toast.length_short); toast.show(); } } };
can this?
there can multiple uuids - represent ble characteristics of device.
http://developer.android.com/reference/android/bluetooth/bluetoothdevice.html#getuuids()
you can iterate on array of uuids , grab 1 want.
if you're looking unique identifier single device want mac address can via bluetoothdevice.getaddress()
Comments
Post a Comment