Download - Beacons in Appcelerator Titanium
BEACONS IN APPCELERATOR TITANIUM
UUID MAJOR MINOR
IMMEDIATE NEAR FAR
IOS 7.1 > ANDROID 4.3 >
https://developer.apple.com/ibeacon/http://altbeacon.github.io/android-
beacon-library/index.html
https://github.com/jbeuckm/TiBeaconshttps://github.com/dwk5123/android-
altbeacon-module
MAX 20 REGIONS SIMULTANUOUS UNLIMITED REGIONS?
Bluetooth 4.0 / 2.4 Ghz Bluetooth 4.0 / 2.4 Ghz
MONITORING VS RANGING
SIGNAL STRENGTH
RSSI
LOCATION & DIRECTION
LOCATION & DIRECTION
FARNEAR
IMMEDIATE
IMPLEMENTING IN TITANIUM
IOS
Ti.Geolocation.requestAuthorization(Ti.Geolocation.AUTHORIZATION_ALWAYS);
var Beacons = require('org.beuckman.tibeacons');
Beacons.addEventListener('determinedRegionState', function (e) { if (e.regionState === 'inside') { Beacons.startRangingForBeacons({ uuid: e.uuid }); } });
Beacons.addEventListener('beaconProximity', function (beacon) { if (_.isUndefined(beacon.rssi)) return; // do your thing });
Beacons.startMonitoringForRegion({uuid: '<uuid>'});
ANDROID
var Beacons = require('com.drtech.altbeacon');
Beacons.addEventListener('serviceBound', function () { Beacons.startMonitoringForRegion({uuid: '<uuid>'}); });
Beacons.addEventListener('beaconProximity', function (beacon) { if (_.isUndefined(beacon.rssi)) return; // do your thing });
Beacons.setAutoRange(true); Beacons.setRunInService(true); Beacons.addBeaconLayout('m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24');
Beacons.bindBeaconService();
BACKGROUND PROCESSES
THE INTERNET LIES
TIMODULE.XML FOR IOS
<ti:module> <iphone> <plist> <dict> <key>UIBackgroundModes</key> <array> <string>location</string> <string>bluetooth-central</string> <string>bluetooth-peripheral</string> </array> </dict> </plist> </iphone> </ti:module>
TIMODULE.XML FOR IOS
<ti:module> <iphone> <plist> <dict> <key>UIBackgroundModes</key> <array> <string>location</string> <string>bluetooth-central</string> <string>bluetooth-peripheral</string> </array> </dict> </plist> </iphone> </ti:module>
TIMODULE.XML FOR IOS
<ti:module> <iphone> <plist> <dict> <key>UIBackgroundModes</key> <array> <string>location</string> <string>bluetooth-central</string> <string>bluetooth-peripheral</string> </array> </dict> </plist> </iphone> </ti:module>
TIMODULE.XML FOR ANDROID
<ti:module> <android> <manifest> <uses-permission android:name="a….p….BLUETOOTH"/> <uses-permission android:name="a….p….BLUETOOTH_ADMIN"/> <uses-permission android:name="a….p….ACCESS_COARSE_LOCATION"/> <application> <service android:enabled="true" android:exported="false" android:isolatedProcess="false" android:label="beacon" android:name="org.altbeacon.beacon.service.BeaconService"/> <service android:name="org.altbeacon.beacon.BeaconIntentProcessor" android:enabled="true"/> </application> </manifest> </android> </ti:module>
TIMODULE.XML FOR ANDROID
<ti:module> <android> <manifest> <uses-permission android:name="a….p….BLUETOOTH"/> <uses-permission android:name="a….p….BLUETOOTH_ADMIN"/> <uses-permission android:name="a….p….ACCESS_COARSE_LOCATION"/> <application> <service android:enabled="true" android:exported="false" android:isolatedProcess="false" android:label="beacon" android:name="org.altbeacon.beacon.service.BeaconService"/> <service android:name="org.altbeacon.beacon.BeaconIntentProcessor" android:enabled="true"/> </application> </manifest> </android> </ti:module>
DO YOUR THING?
SENSIMITY