Android Tutorial

Getting Started

  1. Register your Android App with Hook Mobile
  2. Install the AGE Android SDK
  3. Use the AGE Android SDK

Smart Invitation

  1. Discover
  2. Get Recommended Invites
  3. Send Invitations

Tracking Referrals and Installs

  1. Track Your Referrals
  2. Track Friends Who Install The Same App

Getting Started

Step 1: Register your Android App with Hook Mobile

To begin integrating with the Hook Mobile AGE Platform, register your app with Hook Mobile and enter your app's information.

Create App

You are going to need the app key when setting up your Android app.


Step 2: Install the AGE Android SDK

Before you begin development with the AGE Android SDK, you will need to install the Android SDK and download the AGE SDK. Please notice that AGE SDK requires Android SDK 2.1 (API Level 7) or above.

To install the AGE SDK, copy age-1.0.2.jar to libs folder and add it to classpath in your Android project. Also, you need to add following permissions to your AndroidManifest.xml.

  1. <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  2. <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
  3. <uses-permission android:name="android.permission.INTERNET" />
  4. <uses-permission android:name="android.permission.READ_CONTACTS" />
  5. <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
  6. <uses-permission android:name="android.permission.SEND_SMS"/>

NOTE: android.permission.SEND_SMS is not required if you decide to use only Hook Mobile virtual number to send invitations.


Step 3: Use the AGE Android SDK

Once you have created an application, you can start the SDK when you initialize your activity with the app key you have registered. The first parameter is the type of Android Context. You can pass this object in your Android Activity.

  1. protected void onCreate(android.os.Bundle savedInstanceState) {
  2.  
  3.     Discoverer.activate(this, "Your-App-Key");
  4.     // ... ...
  5.  
  6. }

The usage of the SDK is illustrated in the sample application. Just open the Eclipse project, fill in the app key in the HookMobileSample class in the package com.hookmobile.age.sample, and run the project (ideally in a physical Android phone attached to the dev computer). The buttons in the sample application demonstrate key actions you can perform with the SDK.

Sample App

Smart Invitation

Step 1: Discover

To get a list of contacts from user's addressbook that are most likely to install your app, you need to execute a discovery call:

  1. Discoverer.getInstance().discover();
Sample Leads

Step 2: Get Recommended Invites

It takes Hook Mobile seconds to determine the devices for each of the phone numbers, and come up with an optimized list. The query returns you a list of Leads, which contains phone numbers and device types ordered by the mobile relationship.

  1. List<Lead> leads = Discoverer.getInstance().queryLeads();

Now, you can prompt your user to send personal invites to their friends to maximize the chance of referral success!

Step 3: Send Invitations

The AGE platform enables you to track the performance of your referrals via customized URLs that you can use in invite messages. The newReferral method creates a referral message with the custom URL.

  1. long referralId = Discoverer.getInstance().newReferral(phones, useVirtualNumber, name, message);

The phones parameter is a List of phone numbers you wish to send referrals to. It is typically a list selected from the leads returned by Discoverer.getInstance().queryLeads(). The useVirtualNumber option specifies whether AGE should send out the referrals via its own virtual number. If not, the referrals will be sent out from the app user's device. The name parameter is the name of the app user, or invitation sender. The optional message parameter takes a message template in case you need to overwrite the default one configured in your app profile. Following is a sample message template with the predefined placeholders or variables:

  1. String message = "I thought you might be interested in this app, check it out here %link% - %name%";
  • %link% - Customized referral URL to download the app.

  • %name% - Name of the invitation sender supplied within newReferral call.

Sample Send

NOTE: if your device is not a SMS device (e.g., a tablet), the AGE server will send out the referral message via the virtual number automatically.


Tracking Referrals and Installs

Step 1: Track Your Referrals

The AGE API also allows you to track all referrals you have sent from any device, and get the referrals' click throughs. This makes it possible for you to track referral performance of individual devices, and potentially reward the users who generate the most referral click throughs.

  1. List<Referral> referrals = Discoverer.getInstance().queryReferrals();

Or, if you would like to query an individual referral:

  1. Referral referral = Discoverer.getInstance().queryReferral(referralId);

referralId parameter is the ID of the referral you want to query.

Step 2: Track Friends Who Install The Same App

The AGE platform allows you to find friends who also install the same app from your addressbook. To query for friends installs in your addressbook, you must call the discover method first. And then, you can call the queryInstalls. This method takes a string parameter that indicates how the searching and matching of addressbook should be done.

  • FORWARD - Find contacts within your address book who has the same app.

  • BACKWARD - Find other app users who has your phone number in their address book. When to use this? When the app wants to suggest a long lost friend who has your contact, but not vice versa.

  • MUTUAL - Find contacts within your address book who has the same app and who also has your contact in his/her address book. This query may be useful for engaging a friend to play in multi-player game who already plays the game.

Below is an example:

  1. List<String> installs = Discoverer.getInstance().queryInstalls(Directions.FORWARD);
Sample Track      Sample Installs
 
COMPANY
PRODUCT
iOS SDK
ANDROID SDK
MEDIA
Facebook Twitter LinkedIn

 
Terms & Conditions    l    Privacy    l   © All rights reserved, 2012