Integrate Android SDK

To integrate HOKO in your app, 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>2.0</version>
</dependency>

or Gradle:

compile 'com.hokolinks:hoko:2.0'

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="===YOUR-URL-SCHEME===" />
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
  </intent-filter>
  <intent-filter> <!-- Android M Users add android:autoVerify="true" for AppLinks on this intent-filter-->
    <data android:scheme="http" android:host="===YOUR-APP-SUBDOMAIN===.hoko.link" />
    <data android:scheme="https" android:host="===YOUR-APP-SUBDOMAIN===.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 Smartlink into an actual Deeplink, redirecting the user to the proper Activity or Fragment.

More info on Why do I need a subdomain

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");
}

Setup Android app →