Blog

  • Beacon Android Titanium

    Beacon
    is Bluetooth low-energy (BLE) wireless technology to create a different way of providing location-based information and services to Android devices. The beacons themselvers are small, cheap Bluetooth transmitters. Apps installed on your Android listen out for the signal transmitted by these beacons and responds accordingly when the phone comes into range.

     

    To use Beacon, you need Android 4.3 and above, Bluetooth turned on, and a compatible Android device.

     

    Each Beacon has 3 entries to distinguish them - 

    • UUID
    • Major ID
    • Minor ID

     

    The UUID is an unique identifier. For example, if Big Bazaar decides to deploy beacon sensors inside its store and make an app that can tell the user once they arrive at a specific store, they would define a UUID that is unique to their app and the beacons inside their stores. Inside the stores, they would place beacon devices and configure each of them to use a different “minor” value. For example, at the store A, they would place all beacon devices broadcasting the Starbucks UUID, major value 0, minor 1 near the door, minor 2 near the mugs display and minor value 3 near the cashier. At store B, they would use the same UUID, but major 1 and minor values according to the location inside the store. 

     

    Now to implement the Beacons functionality for Android in Titanium, you need to download the latest module from the link "http://gitt.io/component/com.liferay.beacons" and include that module in your "tiapp.xml" .

     

    Then in your "app.js" file write the code - 

     
     // this sets the background color of the master UIView
    Titanium.UI.setBackgroundColor('#000');
    
    var TiBeacons = require("com.liferay.beacons");
    
    var win = Ti.UI.createWindow({
    	backgroundColor : '#fff'
    });
    
    TiBeacons.startMonitoringForRegion({
    	uuid : < your beacon UUID >,
    	identifier : < your beacon Identifier >,
    	major : < your beacon major >,
    	minor : < your beacon minor >,
    });
    
    TiBeacons.addEventListener("enteredRegion", function(e) {
    	Ti.API.info("enteredRegion" + JSON.stringify(e));
    });
    
    TiBeacons.addEventListener("exitedRegion", function(e) {
    	Ti.API.info("exitedRegion" + JSON.stringify(e));
    });
    
    TiBeacons.addEventListener("determinedRegionState", function(e) {
    	Ti.API.info("determinedRegionState" + JSON.stringify(e));
    });
    
    win.open();
    

Tags: titanium , android , beacon

View All PostsLeave a Comment
comments powered by Disqus

Mobile Applications

Video Content

Bigdata & NoSQL

SaaS Applications

Miscellaneous

Archives


Alexa Certified Site Stats for www.oodlestechnologies.com