Sunday, November 16, 2014

Estimote SDK for Android

Estimote SDK is an abstract way to communicate with the Estimote Beacons. The Android SDK is very similar to the iOS SDK in architecture

The SDK allows for 
- Beacon Ranging (scans beacons and optionally filters them by their properties) 
- Beacon monitoring (monitors regions for those beacons that have exited / entered a region) 
- beacon characteristic reading and writing (proximity UUID, major & minor values, broadcasting power. advertising interval ) 

What is Ranging? 
Ranging allows apps to know the relative distance between a device and beacons. As an example of ranging, if a user is in a department store, then device of the user comes into proximity of the beacon, it can know the distance and determine which department in the store user is close by. 

The Estimote engineers recommend for better ranging of the distance, app be in the foreground. apps can use startRangingBeacon method of BeaconManager to start the ranging operation. 
Ranging code is something like below in Android 

private void connectToService2()
  {
    beaconManager.connect(new BeaconManager.ServiceReadyCallback()
    {
        @Override
        public void onServiceReady()
        {
            try
            {
                beaconManager.startRanging(ALL_ESTIMOTE_BEACONS_REGION);
            }
            catch(RemoteException ex)
            {
                Log.e(TAG,"Cannot start ranging", e);
            }
        }
        
    });
      
  }

Beacon monitoring 
This is a term used to describe a bluetooth device’s usage and detect when a user is in the vicinity of beacons. This can be used to provide contextually aware information. 
Beacon has following properties 

Proximity UUID : 128-bit identifier
major : 16-bit unsigned integer to differentiate between beacons within the same proximity UUID 
minor : 16-bit unsigned integer to differentiate between beacons within the same proximity UUID and major number 

Monitoring is designed to perform periodic scan in the background. By default it scans for 5 seconds and sleeps for 25 seconds. This means that it can take up to 30 seconds to detect entering or exiting region. 
Default behaviour can be changed via BeaconManager#setBackgroundScanPeriod. 

Running the Demo
Demos in The Estimote directory are said to be can be built with Gradle by typing gradleview installDebug

Tried to run this via the Android Studio, as it supports Gradle based projects, When tried to open the project, found the below that Gradle path is not set and did not have Gradle. Downloaded the Gradle and set the path in the Android SDK, It gave an error initially saying the Gradle used to build the demo was old, but later it got automatically corrected! . Still to find, how ?? Anyway, a detailed analysis of Gradle is required. 



References 

No comments:

Post a Comment