Short.io provides mobile deep linking for Android and IOS apps. For example, when users click a short link that is correctly configured in your Android app, they will be redirected to the app, if it is installed. If the application is not installed, the URL will be opened in their browser.
Note: Deep linking is available starting from the Team Plan.
Requirements for using Android application links
Active short domain
Android 6.0 or later
How to configure deep links
Android Manifest settings
Open the AndroidManifest.xml file of your application:
Inform the Android system that the link must be opened in the application, not on the website by adding intent filters to the manifest between <activity>:
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
android:host="shortcm.xyz" <!-- SHORT DOMAIN -->
<!-- Any path. You can also remove the line below, if you want to configure deep links for the whole short domain, not a particular short link -->
android:pathPrefix="/myapplication"/>
<!-- Any path. You can also remove the line above, if you want to configure deep links for the whole short domain, not a particular short link -->
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Android MainActivity commands
To process deep links in the application, add these lines to the MainActivity.kt/.java or any other Activity file.
Note: Ensure that you include import android.net.Uri if it has not been added previously.
Kotlin
val data: Uri? = this.intent.data
if (data != null && data.isHierarchical()) {
val uri = this.intent.dataString
Log.i("MyApp", "Deep link clicked $uri")
}
Java
Uri data = this.getIntent().getData();if (data != null && data.isHierarchical()) { String uri = this.getIntent().getDataString(); Log.i("MyApp", "Deep link clicked " + uri);}
Configure deep links on Short.io
Sign in to your Short.io account.
Navigate to Domain Settings > Deep links:
In the Configuration for Android panel fill in the following details and click on Save to confirm:
Android App Package Name
Android SHA256 Certificate Fingerprint
You can find information on how to locate the App Package Name and the Certificate Fingerprint in this article.
Note: The debug (in-dev) android application SHA-256 can sometimes be different from the release version. To make in-dev app automatically pick up URLs, you need to get its SHA-256 using the "gradle signingReport" command
as demonstrated below:
From Android Studio click on the Gradle icon and then on Execute Gradle Task icon
to display the Run Anything dialog:
Then type gradle signingReport and select it from the list. Your signing results for Debug and Release versions will be generated:
Run your app
Run the Android Studio emulator and follow the link you have specified in the AndroidManifest:
<data android:scheme="https"
android:host="shortcm.xyz"
android:pathPrefix="/myapplication"/>
In the above case the link is: https://shortcm.xyz/myapplication
If the link does not exist, you will get an error message. Send a link via email and browse it from an emulator. You will have the option to open the short link using either a web browser or your application:
Watch a video guide on how Short.io deep links work: