320 likes | 344 Views
Audio from talk (OSCON - July 22nd, 2015): https://archive.org/details/oscon_mobile_location_aware_systems_with_beacons What if instead of a broad location, you could have pinpoint location awareness of someone in a physical space. How could this change everything about how we interact with the physical world? In this session we will be exploring Beacon technology, which enables this, the underlying Bluetooth Smart standard, and how we can use these systems to change everything from shopping, to accessibility for the disabled, all built on top of a mobile device.
E N D
Building a Mobile Location Aware System with Beacons Jonathan LeBlanc (@jcleblanc) Head of Global Developer Advocacy at PayPal + Braintree
Purpose of a Beacon twitter: @jcleblanc | hashtag: #OSCON
Being Location Aware twitter: @jcleblanc | hashtag: #OSCON
Real World Use Case twitter: @jcleblanc | hashtag: #OSCON
How it Works Central Device Beacon Hardware IP Address Endpoint twitter: @jcleblanc | hashtag: #OSCON
Beacon Comparison Estimote: $99 / 3, temp + motion Bluecat: Trial, AA batteries Gimbal Tag: $5, small & deployable Kontakt.io: $81 / 3, battery life twitter: @jcleblanc | hashtag: #OSCON
Beacon Advertisement & ID • UUID (16 bytes): Differentiates Large Group • Major (2 bytes): Beacon Subset • Minor (2 bytes): Individual Beacon • Tx Power: Proximity from beacon twitter: @jcleblanc | hashtag: #OSCON
Don’t be Creepy twitter: @jcleblanc | hashtag: #OSCON
Deploy Considerations twitter: @jcleblanc | hashtag: #OSCON
Battery Life vs Range twitter: @jcleblanc | hashtag: #OSCON
Battery Replacement twitter: @jcleblanc | hashtag: #OSCON
Signal Interference 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
Signal Degradation twitter: @jcleblanc | hashtag: #OSCON
Low Interference Medium Interference Water Wood Bricks Synthetic Material Marble Glass High Interference Very High Interference Plaster Concrete Metal Bulletproof Glass
Attaching to a Beacon twitter: @jcleblanc | hashtag: #OSCON
AndroidManifest.xml <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"/> twitter: @jcleblanc | hashtag: #OSCON
Adjusting Beacon Settings Estimote Site and App twitter: @jcleblanc | hashtag: #OSCON
The Beacon Connection connection = new BeaconConnection(this, beacon, new BeaconConnection.ConnectionCallback(){ @Override public void onAuthenticated(){ ... } @Override public void onAuthenticationError(){ ... } @Override public void onDisconnected(){ ... } }); connection.authenticate(); connection.close(); twitter: @jcleblanc | hashtag: #OSCON
Adjusting Beacon Settings //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){} }); twitter: @jcleblanc | hashtag: #OSCON
Updatable Settings • AdvertisingInterval • BroadcastingPower • Major • Minor • ProximityUuid twitter: @jcleblanc | hashtag: #OSCON
The Android Emulator twitter: @jcleblanc | hashtag: #OSCON
Emulating Android & BLE Virtual Machine Software + USB BLE adapter http://chrislarson.me/blog/ emulate-android-and-bluetooth- le-hardware.html twitter: @jcleblanc | hashtag: #OSCON
Collecting Range Data twitter: @jcleblanc | hashtag: #OSCON
The Beacon Object • 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 twitter: @jcleblanc | hashtag: #OSCON
Setting the Beacon Manager private static final Region ALL_BEACONS = new Region("regionId", null, null, null); private BeaconManager beaconManager = new BeaconManager(this); twitter: @jcleblanc | hashtag: #OSCON
Setting the Listener beaconManager.setRangingListener(new BeaconManager.RangingListener() { @Override public void onBeaconsDiscovered(Region region, List<Beacon> beacons) { for (Beacon rangedBeacon : beacons) { double currentDistance = Utils.computeAccuracy(rangedBeacon); … } } }); twitter: @jcleblanc | hashtag: #OSCON
Getting Beacon Range beaconManager.connect( new BeaconManager.ServiceReadyCallback(){ @Override public void onServiceReady(){ try{ beaconManager.startRanging(ALL_BEACONS); } catch (RemoteException e) { Log.e(TAG, "Cannot start ranging", e); } } }); 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
Beacon Wrap-up twitter: @jcleblanc | hashtag: #OSCON
Thank You! http://slideshare.net/jcleblanc Jonathan LeBlanc (@jcleblanc) Head of Global Developer Advocacy at PayPal + Braintree