Using iBeacons in Titanium

  • View
    1.192

  • Download
    0

  • Category

    Mobile

Preview:

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.

Citation preview

Implementing Beacon Technology in Titanium!!

Martin Hudson!!

BEACONS

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

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

BEACON TECHNOLOGY

• Small Bluetooth emitting devices!

• Battery powered!

• Significantly larger range than NFC!

• Uses Bluetooth Low Energy (LE) protocol

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

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

BARRIERS TO ENTRY

• Upfront costs

- Beacons, licences for services!

• Implementation

- Installation of beacons, databases, content!

• Security

- Physical and software

BEACONS IN ACTION

BEACONS IN ACTION

UUID MajorRSSI Minor

Power Complement

ABSORPTION ISSUES

ABSORPTION ISSUES

ABSORPTION ISSUES

BUFFER ZONES

BUFFER ZONES

BUFFER ZONES

BUFFER ZONES

Entrance Region

Exit Region

BUFFER ZONES

BUFFER ZONES

BUFFER ZONES

BUFFER ZONES

BUFFER ZONES

1 2

3 4

TRIANGULATION

1 2

3 4

Triangulation is highly inaccurate

- Reflection

TRIANGULATION

1 2

3 4

Triangulation is highly inaccurate

- Reflection

- Refraction

TRIANGULATION

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

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

TIBEACON MODULE

• Allows you to create up to 5 beacon regions!

• Regions defined by;!

- UUID!

- UUID and major!

- UUID, major, and minor

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");

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

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.

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 } }); !

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.

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.

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 }); !!

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.

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.

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();

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.

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){ //… } });

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: martin.hudson@mobiledatasystems.co

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

Recommended