Building a Mobile Location Aware System with Beacons
-
Upload
jonathan-leblanc -
Category
Technology
-
view
1.303 -
download
2
Transcript of Building a Mobile Location Aware System with Beacons
Building a Mobile Location Aware System with Beacons
Jonathan LeBlanc (@jcleblanc) Head of Global Developer Advocacy at PayPal + Braintree
Central Device
Beacon Hardware
IP Address Endpoint
How it Works
twitter: @jcleblanc | hashtag: #OSCON
twitter: @jcleblanc | hashtag: #OSCON
Estimote: $99 / 3, temp + motion
Beacon Comparison
Bluecat: Trial, AA batteries
Gimbal Tag: $5, small & deployable
Kontakt.io: $81 / 3, battery life
• UUID (16 bytes): Differentiates Large Group
• Major (2 bytes): Beacon Subset
• Minor (2 bytes): Individual Beacon
• Tx Power: Proximity from beacon
Beacon Advertisement & ID
twitter: @jcleblanc | hashtag: #OSCON
• Microwave ovens
• Direct Satellite Service (DSS)
• Certain external electrical sources
• 2.4 GHz or 5 GHz phones
• Video transmitters/receivers that operate in the 2.4
GHz or 5 GHz bandwidth
• Wireless speakers that operate in the 2.4 GHz or 5
GHz band
• Certain external monitors and LCD displays
• Any other wireless devices that operate in the 2.4
GHz or 5 GHz bandwidth
twitter: @jcleblanc | hashtag: #OSCON
Low Interference Medium Interference
High Interference Very High Interference
Wood
Synthetic Material
Glass
Water
Bricks
Marble
Plaster
Concrete
Bulletproof Glass
Metal
<uses-permission android:name=
"android.permission.BLUETOOTH"/>
<uses-permission android:name=
"android.permission.BLUETOOTH_ADMIN"/>
<service android:name=
”com.estimote.sdk.service.BeaconService"
android:exported="false"/>
AndroidManifest.xml
twitter: @jcleblanc | hashtag: #OSCON
connection = new BeaconConnection(this, beacon, new
BeaconConnection.ConnectionCallback(){
@Override public void onAuthenticated(){ ... }
@Override public void onAuthenticationError(){ ... }
@Override public void onDisconnected(){ ... }
});
connection.authenticate();
connection.close();
The Beacon Connection
twitter: @jcleblanc | hashtag: #OSCON
//update the beacon UUID and Major
connection.edit()
.set(connection.major(), newMajor)
.commit(new BeaconConnection.WriteCallback(){
@Override public void onSuccess(){}
@Override public void
onError(EstimoteDeviceException exception){}
});
Adjusting Beacon Settings
twitter: @jcleblanc | hashtag: #OSCON
• AdvertisingInterval
• BroadcastingPower
• Major
• Minor
• ProximityUuid
Updatable Settings
twitter: @jcleblanc | hashtag: #OSCON
twitter: @jcleblanc | hashtag: #OSCON
Virtual Machine Software +
USB BLE adapter
http://chrislarson.me/blog/emulate-android-and-bluetooth-le-hardware.html
Emulating Android & BLE
• getProximityUUID: Proximity UUID of the Beacon
• getMajor: Major version of the beacon • getMinor: Minor version of the beacon
• getMeasuredPower: Beacon measured power
(in dBm)
• getMacAddress: Beacon MAC address
• getName: Display friendly beacon name • getRssi: Received Signal Strength Indication
The Beacon Object
twitter: @jcleblanc | hashtag: #OSCON
private static final Region ALL_BEACONS =
new Region("regionId", null, null, null);
private BeaconManager beaconManager = new
BeaconManager(this);
Setting the Beacon Manager
twitter: @jcleblanc | hashtag: #OSCON
beaconManager.setRangingListener(new BeaconManager.RangingListener() { @Override public void onBeaconsDiscovered(Region region, List<Beacon> beacons) {
for (Beacon rangedBeacon : beacons) { double currentDistance = Utils.computeAccuracy(rangedBeacon); … }
} });
Setting the Listener
twitter: @jcleblanc | hashtag: #OSCON
beaconManager.connect(
new BeaconManager.ServiceReadyCallback(){
@Override public void onServiceReady(){
try{
beaconManager.startRanging(ALL_BEACONS);
} catch (RemoteException e) {
Log.e(TAG, "Cannot start ranging", e);
}
}
});
Getting Beacon Range
twitter: @jcleblanc | hashtag: #OSCON
iBeacon Specification https://developer.apple.com/ibeacon/
Estimote Javadocs http://estimote.github.io/Android-SDK/JavaDocs/
AltBeacon http://altbeacon.org/examples/
twitter: @jcleblanc | hashtag: #OSCON