Integrate Android SDK

To integrate HOKO in your app (only Android 1.6 — API level 4 — and higher), simply follow the 3 simple steps below.

Install HOKO in your project

Download the latest AAR or grab via Maven:

<dependency>
  <groupId>com.hokolinks</groupId>
  <artifactId>hoko</artifactId>
  <version>...</version>
</dependency>

or Gradle ( in order to install using Gradle, you will need to add the following line in your build.gradle (Module: app) file inside the dependencies { } block ):

compile 'com.hokolinks:hoko:...'

Setting up the AndroidManifest.xml

Add the following lines to your AndroidManifest.xml to make sure to have the following permissions:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Now for the actual deeplinking, please add the Activity and Receiver to the application of your AndroidManifest.xml

<activity
  android:name="com.hokolinks.activity.HokoActivity"
  android:alwaysRetainTaskState="true"
  android:launchMode="singleTask"
  android:noHistory="true"
  android:theme="@android:style/Theme.Translucent.NoTitleBar">
  <intent-filter>
    <data android:scheme="yourapp" />
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
  </intent-filter>
</activity>
<activity
  android:name="com.hokolinks.activity.HokoAppLinksActivity"
  android:alwaysRetainTaskState="true"
  android:launchMode="singleTask"
  android:noHistory="true"
  android:theme="@android:style/Theme.Translucent.NoTitleBar">
  <intent-filter> <!-- Android M Users add android:autoVerify="true" for AppLinks on this intent-filter-->
    <data android:scheme="http" android:host="yourapp.hoko.link" /> <!-- Or your own custom domain -->
    <data android:scheme="https" android:host="yourapp.hoko.link" />
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
  </intent-filter>
</activity>
<receiver android:name="com.hokolinks.deeplinking.DeferredDeeplinkingBroadcastReceiver"
  android:exported="true">
  <intent-filter>
    <action android:name="com.android.vending.INSTALL_REFERRER" />
  </intent-filter>
</receiver>

The subdomain will be used to avoid request the user on which app to open the link and to avoid going through an HTML page redirect. Everytime a link with http://yourapp.hoko.link domain gets opened, it will automatically open your app and resolve the smart link into an actual Deeplink, redirecting the user to the proper Activity or Fragment.

See the Why do I need a subdomain section for more information regarding this.

SDK Setup

In your Application subclass setup the HOKO Framework in the onCreate() method:

@Override
public void onCreate() {
  super.onCreate();
  Hoko.setup(this, "YOUR-APP-TOKEN");
}

We advise you to setup the SDK on your Application's subclass onCreate() method because it guarantees that the SDK will be initialized when the application is launched.

Note: Check the Logs for your device token so you can upload routes into HOKO!

Setup your mobile deep linking →