android - detect iBeacon using altbeacon library -



android - detect iBeacon using altbeacon library -

i developing project uses ibeacons library

is code recognize beacon ?

beaconmanager.startmonitoringbeaconsinregion(new region("d1b024cb-a02d-4650-9c6a-baeda8a31f0e", null, null, null));

i have uuid major , minor, how utilize them ?

hope help

public class rangingactivity extends activity implements beaconconsumer { protected static final string tag = "rangingactivity"; private static final string uuid = "xxxxxxxxxxxxxxxxxxxx"; private beaconmanager beaconmanager = beaconmanager.getinstanceforapplication(this); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_ranging); beaconmanager.bind(this); } @override protected void ondestroy() { super.ondestroy(); beaconmanager.unbind(this); } @override public void onbeaconserviceconnect() { beaconmanager.setrangenotifier(new rangenotifier() { @override public void didrangebeaconsinregion(collection<beacon> beacons, part region) { if (beacons.size() > 0) { log.i(tag, "the first beacon see "+beacons.iterator().next().getdistance()+" meters away."); } } }); seek { beaconmanager.startrangingbeaconsinregion(new region("myranginguniqueid", identifier.parse(uuid), null, null)); } grab (remoteexception e) { } beaconmanager.getbeaconparsers().add(new beaconparser() .setbeaconlayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24")); } }

in androidmanifest.xml permissions

<uses-permission android:name="android.permission.bluetooth" /> <uses-permission android:name="android.permission.bluetooth_admin" /> <uses-permission android:name="android.permission.receive_boot_completed" />

register

<service android:name="org.altbeacon.beacon.service.beaconservice" android:enabled="true" android:exported="true" android:isolatedprocess="false" android:label="beacon" > </service> <service android:name="org.altbeacon.beacon.beaconintentprocessor" android:enabled="true" > </service> <receiver android:name="org.altbeacon.beacon.startup.startupbroadcastreceiver" > <intent-filter> <action android:name="android.intent.action.boot_completed" /> <action android:name="android.intent.action.action_power_connected" /> <action android:name="android.intent.action.action_power_disconnected" /> </intent-filter> </receiver>

android eclipse ibeacon altbeacon

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -