Overview

Skill Level: Any Skill Level

Skyhook Context can help you enhance your mobile ad campaigns through advanced geofencing, accurate venues, custom personas and analytics. Skyhook Context provides insights that can enhance customer loyalty and help target content or ad campaigns.

Ingredients

Requires a mobile device running the Android Operating System (OS)

Supported on the following Android OS versions:

  • 2.2 (Froyo)
  • 2.3.x (Gingerbread)
  • 4.0.x (Ice Cream Sandwich)
  • 4.1.x-4.3 (Jelly Bean)
  • 4.4 (KitKat)
  • 5.0-5.1 (Lollipop)
  • 6.0 (Marshmallow) including forked platforms such as the Kindle Fire

Step-by-step

  1. Download the Software Development Kit

    1. Visit my.skyhookwireless.com
    2. Either log in to your existing account or create a new account
    3. Create a “Context” project
    4. Download the Android SDK 

     

    Skyhook Context is free to try for 14 days.

  2. Install the SDK

    1. Open the zip file containing the Context Accelerator SDK.
    2. The accelerator library files are found in the “lib” directory of the SDK.¬†
      • If you are using Eclipse/ADT:
        • Add all of the contents of the “lib”¬†directory to the “libs” directory of your project.
      • If you are using Android Studio:
        • Add all *.jar files to the “libs” directory (or any other of your choice) of your project.
        • Add dependencies to your build.gradle:¬†
    dependencies {
    compilefiles('libs/accelerator.jar'
    'libs/commons-codec-1.3.jar',
    'libs/guava-r09.jar',
    'libs/jsr305.jar',
    'libs/s2-geometry-java.jar',
    'libs/sqlite4java.jar')
    }
    1. Copy the “libs/armeabi” and “libs/arm64-v8a” directories from the SDK to the “src/main/jniLibs” directory of your project.
      • Add the accelerator service to your manifest.
    <application
    ...

    <service
    android:name="com.skyhookwireless.accelerator.AcceleratorService"
    android:exported="false" />
    </application>
    • Add the required permissions¬†to your manifest.
    <!-- used to communicate with Skyhook's servers -->
    <uses-permission android:name="android.permission.INTERNET" />
    <!-- used to enable Wi-Fi, if disabled, for the duration of a location request -->
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <!-- used to obtain information about the Wi-Fi environment -->
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <!-- used to obtain Wi-Fi or cellular based locations -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <!-- used to access GPS location for hybrid location functionality -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <!-- used to keep processor awake when receiving background updates -->
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <!-- used to check network connection type to optimize performance -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    1. Using the Android Emulator
      • The Context Accelerator SDK will not be able to determine location using Wi-Fi or cellular beacons from the emulator because it is unable to scan for those signals. Because of that, its functionality will be limited on the emulator. In order to verify your integration of the SDK using the emulator, you may want to use the “requestIPLocation()” method call. The full functionality will work only on an Android device.¬†
  3. Initialize the service

    1. Import the SDK
      • Import the accelerator client and any other accelerator components where needed.
    import com.skyhookwireless.accelerator.AcceleratorClient;
    1. Instantiate the accelerator client
      • Connect to the accelerator service, and wait for the connection to complete successfully before calling any of the other accelerator methods.¬†
    public class YourActivity
    extends ...
    implements ...
    ConnectionCallbacks,
    OnConnectionFailedListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    ...

    accelerator = new AcceleratorClient(this, yourKey, this, this);
    accelerator.connect();
    }

    @Override
    protected void onDestroy() {
    ...

    accelerator.disconnect();
    }

    @Override
    public void onConnected() {
    // It is now safe to call any of the demographic persona or IP
    // location accelerator methods. Before calling any of the
    // campaign monitoring methods, a pending intent first needs to
    // be registered for campaign monitoring, and before calling the
    // isMonitoringAllCampaigns() or getMonitoredCampaigns() methods,
    // that registration must be complete.

    handle successful connection...
    }

    @Override
    public void onDisconnected() {
    handle disconnection...
    }

    @Override
    public void onConnectionFailed(int errorCode) {
    handle connection failure...
    }

    private AcceleratorClient accelerator;
    }
    1. Grant the location permissions
      • With the new permissions model introduced in Android M, Skyhook Context requires location permission to be granted before calling most of its methods. Depending on how Skyhook Context is used in the application, the developer can decide when to request the permission and if an explanation needs to be displayed for the user.
  4. Enable Optional Features

    The baseline version of Skyhook Context will enable you to create and monitor an unlimited number of geofences for your mobile application.  Additional features include:

    • Skyhook Personas – Personas are anonymized mobile segments generated based on where consumers live, visit and shop. ¬†Example Personas include: Luxury Shoppers, Casual Diners or Pet Owners. ¬†
    • IP Location – Skyhook Context can¬†also provide coarse location using IP addresses.
    • Skyhook Venues – Skyhook meticulously curates and positions an extensive set of retail venues that you can use for targeted advertising or competitive intelligence.¬†

     

    Access the Skyhook Context recipe on my.skyhookwireless.com to take advantage of these additional features.

    Context works in conjunction with Precision Location.  Visit our listing in the marketplace for more information.

  5. Connect to your desired IBM service

    Now that your Android-based application or service is Skyhook Context-enabled, connect to the applicable IBM service such as BlueMix or Watson to enjoy end-to-end functionality.  Various recipes exist on the IBM developerWorks to walk you through these steps.

    If you have any questions, please submit a support ticket via my.skyhookwireless.com or by emailing support@skyhook.com after you have created an account.

Join The Discussion