Short.io provides deep linking for Android apps. 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 a browser.
Note: Deep linking requires the **Team Plan**.
Requirements for Using Android Application Links
-
Active short domain.
-
Android 6.0 or later.
How to configure deep links in Short.io and Android App
1. Open the AndroidManifest.xml file.
2. Add intent filters to the manifest.
We inform the Android system that the link must be opened in the application, not on the website.
Add intent filters between activity: https://codepen.io/Shortio/pen/oNbYWOM
3. Configure deep links on Short.io.
-
Go to Short.io.
-
Open the Deep links tab.
- Specify Android App Package name and SHA256 Fingerprint Certificate > Save.
Here's how to find Android App Package name and SHA256 Fingerprint Certificate: https://help.short.io/en/articles/4171170-where-to-find-android-app-package-name-and-sha256-fingerprint-certificate
4. Add commands to process deep links in the application.
Add these lines to the MainActivity.kt/.java or any other Activity file.
- 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);
}
5. Run the emulator and follow the link you've specified in the AndroidManifest.
In our case the link is: https://shortcm.xyz/myapplication
If the link doesn't exist, you will get an error message. Send a link via email to click it via emulator. You'll be offered to open the short link via a browser, or your app.
What did you learn?
- android deep links
- android app links
- how to set up android link
- how to configure short deep links on android
Inspired by: