Using iBeacons in Titanium

39
Implementing Beacon Technology in Titanium Martin Hudson BEACONS Mobile Data Systems http://www.mobiledatasystems.co

description

iBeacons show great promise, but real-world issues prevent them from working as well as we might like. This presentation describes the issues and proposes some possible solutions.

Transcript of Using iBeacons in Titanium

Page 1: Using iBeacons in Titanium

Implementing Beacon Technology in Titanium!!

Martin Hudson!!

BEACONS

Mobile Data Systems!http://www.mobiledatasystems.co

Page 2: Using iBeacons in Titanium

INDOOR LOCALISATION

• GPS is not an option

- Low spatial discrimination (10m)!- Poor signal penetrance through buildings!

• Unique building shapes - Signal reflection issues!

• Noisy environment - Many signals, varying crowd density

Page 3: Using iBeacons in Titanium

BEACON TECHNOLOGY

• Small Bluetooth emitting devices!

• Battery powered!

• Significantly larger range than NFC!

• Uses Bluetooth Low Energy (LE) protocol

Page 4: Using iBeacons in Titanium

Geofencing

Passive process, alerting user to location based information!

Outdoors

- Reminders!

Indoors

- Art gallery walkthroughs!

- Special offers

Geolocation

Active process, providing user with precise location!

Outdoors & Indoors

- Route navigation

USE CASES

Page 5: Using iBeacons in Titanium

Geofencing

Passive process, alerting user to location based information!

Outdoors

- Reminders!

Indoors

- Art gallery walkthroughs!

- Special offers

Geolocation

Active process, providing user with precise location!

Outdoors & Indoors

- Route navigation

USE CASES

Page 6: Using iBeacons in Titanium

BARRIERS TO ENTRY

• Upfront costs

- Beacons, licences for services!

• Implementation

- Installation of beacons, databases, content!

• Security

- Physical and software

Page 7: Using iBeacons in Titanium

BEACONS IN ACTION

Page 8: Using iBeacons in Titanium

BEACONS IN ACTION

UUID MajorRSSI Minor

Power Complement

Page 9: Using iBeacons in Titanium

ABSORPTION ISSUES

Page 10: Using iBeacons in Titanium

ABSORPTION ISSUES

Page 11: Using iBeacons in Titanium

ABSORPTION ISSUES

Page 12: Using iBeacons in Titanium

BUFFER ZONES

Page 13: Using iBeacons in Titanium

BUFFER ZONES

Page 14: Using iBeacons in Titanium

BUFFER ZONES

Page 15: Using iBeacons in Titanium

BUFFER ZONES

Entrance Region

Exit Region

Page 16: Using iBeacons in Titanium

BUFFER ZONES

Page 17: Using iBeacons in Titanium

BUFFER ZONES

Page 18: Using iBeacons in Titanium

BUFFER ZONES

Page 19: Using iBeacons in Titanium

BUFFER ZONES

Page 20: Using iBeacons in Titanium

BUFFER ZONES

Page 21: Using iBeacons in Titanium

1 2

3 4

TRIANGULATION

Page 22: Using iBeacons in Titanium

1 2

3 4

Triangulation is highly inaccurate

- Reflection

TRIANGULATION

Page 23: Using iBeacons in Titanium

1 2

3 4

Triangulation is highly inaccurate

- Reflection

- Refraction

TRIANGULATION

Page 24: Using iBeacons in Titanium

1 2

3 4

Each point x,y co-ordinates

Collect several training data sets at different orientations

Beacon 1 RSSI!Beacon 2 RSSI!Beacon 3 RSSI!

Beacon 1 RSSI!Beacon 2 RSSI!Beacon 3 RSSI!

Beacon 1 RSSI!Beacon 2 RSSI!Beacon 3 RSSI!

Beacon 1 RSSI!Beacon 2 RSSI!Beacon 3 RSSI!

FINGERPRINTING

Page 25: Using iBeacons in Titanium

Mobile device receives an RSSI from each beacon, creating its

own data set.

The received data set is compared with the training data set to estimate the most probable user location

1 2

3 4

FINGERPRINTING

Page 26: Using iBeacons in Titanium

TIBEACON MODULE

• Allows you to create up to 5 beacon regions!

• Regions defined by;!

- UUID!

- UUID and major!

- UUID, major, and minor

Page 27: Using iBeacons in Titanium

ACCESSING THE MODULE

To access the module in JavaScript, you would do the following;!

!

!

The TiBeacon variable is a reference to the Module object.

var TiBeacon = require("co.mobiledatasystems.tibeacon");

Page 28: Using iBeacons in Titanium

REFERENCEThe following functions are exposed;!

• initializeBeaconMonitoring - used to register the app with core location services

• startMonitoringBeaconRegion - can be called several times and is used to register a region with core location services

• stopMonitoringBeaconRegion - used to stop and clear down a region and remove it from core location services!

• stopAllBeacons - used to stop and clear down all the beacon regions and remove them all from core location services!

• sendLocalNotification - a convenience function that allows you to send an immediate local notification

Page 29: Using iBeacons in Titanium

initializeBeaconMonitoringarguments:!

• success - A function that is called when the module successfully registers with core location services.!

• error - A function that is called when the module fails to register with core location services.!

• region - A function that is called when we detect we have entered or exited a beacon region.!

• ranged - A function that is called whenever we successfully process beacon monitoring (roughly every second) and returns the beacons found.!

• change - A function that is called when we detect another beacon is the nearest one.!

purpose: Used to register the app with core location services. We specify the functions that will be called when one of the modules events fire.

Page 30: Using iBeacons in Titanium

initializeBeaconMonitoringTiBeacon.initializeBeaconMonitoring({ success:function(e){ //called when we have registered core location services }, error:function(e){ //called if we fail to register the core location services alert("This device doesn't support iBeacons"); }, region:function(e){ //called when we enter or exit a region }, ranged:function(e){ //when the app is in foreground, this returns all the beacons }, change:function(e){ //called when a new beacon becomes the nearest one } }); !

Page 31: Using iBeacons in Titanium

startMonitoringBeaconRegion

arguments: !

• uuid - The uuid we will listen for, estimotes use this by default ‘B9407F30-F5F8-466E-AFF9-25556B57FE6D’.!

• major - The major value that the beacon will transmit (optional, may be omitted).!

• minor - The minor value that the beacon will transmit (optional, may be omitted).!

• identifier - A string we use to identify the region. It is returned in the beacon data so we can identify the region the beacon belongs to.!

• notifyEntryStateOnDisplay - Should be left set to true, used for module debugging purposes.!

• keepRanging - When we have exited a region, if false ranging will be switched off until we detect we entered the region again. This may be slow but significantly saves battery power. Setting to true leaves ranging on, improving performance at the expense of power consumption.

Page 32: Using iBeacons in Titanium

startMonitoringBeaconRegion

purpose: !

We call this once we have successfully registered the module with core location services. Core location services will detect when we have entered or exited a beacon region, even if the app is no longer running and will fire the regionChanged event. This is exposed in the region event in

the 'initializeBeaconMonitoring' function.!

If the app is running in foreground and the 'keepRanging' argument is 'true' then regardless of whether we are in a region we will continue to check for beacons.!

If a beacon is detected that belongs to the beacon region, its data is returned in the ranged

event. This is exposed in the ranged event in the 'initializeBeaconMonitoring' function. If we

detect that a different beacon in the same region is now neared then the change event is fired.

Page 33: Using iBeacons in Titanium

startMonitoringBeaconRegion// begin monitoring a specific region. // must initialise beacons before calling this method // we can call this several times to create different regions to monitor !beacons.startMonitoringBeaconRegion({ uuid:'B9407F30-F5F8-466E-AFF9-25556B57FE6D', identifier:'all', // a logical name that is returned when beacons // fire events so we can easily identify which // region they belong to ! notifyEntryStateOnDisplay:true, ! keepRanging:true // tells the module to keep on ranging even if // no beacons are in a region, this improves // performance at the expense of power consumption }); !!

Page 34: Using iBeacons in Titanium

stopMonitoringBeaconRegion

arguments:!

• identifier - The string we used to identify the region when we started monitoring.!

purpose: Stop monitoring for that region and remove it from core location services. You can therefore safely call startMonitoringBeaconRegion again to begin monitoring for the same region if you then wish.

Page 35: Using iBeacons in Titanium

stopMonitoringBeaconRegion

arguments:!

• identifier - The string we used to identify the region when we started monitoring.!

purpose: Stop monitoring for that region and remove it from core location services. You can therefore safely call startMonitoringBeaconRegion again to begin monitoring for the same region if you then wish.

stopAllBeaconsarguments: None!

purpose: Stop monitoring for all the regions and remove them from core location services.

Page 36: Using iBeacons in Titanium

stopping Monitoring// stop monitoring for a specific region !// we can stop a specific region TiBeacon.stopMonitoringBeaconRegion({ identifier:'all' }); !// …or we can stop monitoring all the regions // stop monitoring all regions TiBeacon.stopAllBeacons();

Page 37: Using iBeacons in Titanium

sendLocalNotification

arguments:!

• message - The string we will display in the local notification.!

• sound - The sound we will play when the local notification fires.!

purpose: A convenience method to send a local notification. Even if the app is no longer running, if we detect a region event (i.e. we have entered or exited a region) core location services will open the app and trigger the region event for a few seconds before shutting down again. You can therefore call this function to trigger a local notification to alert the user that they have entered or exited a beacon region.

Page 38: Using iBeacons in Titanium

sendLocalNotificationTiBeacon.initializeBeaconMonitoring({ success:function(e){ //… }, error:function(e){ //… }, region:function(e){ // we can use the convenience method to trigger a local // notification… even if the app isn't running! ! // we can test for 'entered' or 'exited' if(e.status === 'entered' && e.identifier === 'all'){ beacons.sendLocalNotification({ message:'Hello from the beacon demo', sound:'/sounds/siren.mp3' }); } }, ranged:function(e){ //… }, change:function(e){ //… } });

Page 39: Using iBeacons in Titanium

LICENSECommercial, Royalty free, see license details.!

You are allowed to use the module in as many titanium projects as you like, including any commercial apps you sell.

Martin Hudson MSc!MAPM mobile data systems ltd.!

email: [email protected]

Public repo: https://bitbucket.org/tojoroja/tibeacon