bluetooth lowenergy - Using Android Beacon Library to transmit as iBeacon -
i trying transmit ibeacon using android beacon library not sure if code right. use app nrf master control panel verify if transmitting ibeacon doesn't seem that.
below code
beacon beacon = new beacon.builder() .setid1("6fb0e0e9-2ae6-49d3-bba3-3cb7698c77e2") .setid2(integer.tostring(minor1)) .setid3(integer.tostring(minor2)) .setmanufacturer(0x0000) .settxpower(-59) .setdatafields(arrays.aslist(new long[] {0l})) .build(); beaconparser beaconparser = new beaconparser() .setbeaconlayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"); beacontransmitter beacontransmitter = new beacontransmitter(getapplicationcontext(), beaconparser); beacontransmitter.startadvertising(beacon); } });
thanks!
the code looks correct. few tips:
- make sure bluetooth turned on.
- verify device supports transmission. check list here http://altbeacon.github.io/android-beacon-library/beacon-transmitter-devices.html
make call test if supported:
int result = beacontransmitter.checktransmissionsupported(context);
if device supports transmission, method returns beacontransmitter.supported
. may return:
not_supported_min_sdk not_supported_ble not_supported_multiple_advertisements (deprecated) not_supported_cannot_get_advertiser_multiple_advertisements not_supported_cannot_get_advertiser
the not_supported_cannot_get_advertiser_multiple_advertisements
, not_supported_multiple_advertisements
, not_supported_cannot_get_advertiser
return typically indicates device either not have compatible chipset, or manufacturer has not implemented driver support required google android 5.x ble transmission apis.
Comments
Post a Comment