Deep linking In Android App — Meteor JS

Vedant Sasane
Fasal Engineering
Published in
4 min readFeb 16, 2023

This blog will be in continuation of our previous blog, in which my teammate explained what are deep links why we need them and how can we integrate deep-linking in our meteor app.

This blog majorly focuses on some additional steps which are required to make deep-linking work in our app (in newer android versions) and some debugging techniques to check if our links are actually working.

Associating the App with our Websites

In order to verify if our android app is associated with the website we need to publish the Digital Asset Links file on our websites. This JSON file will look something like this,

[
{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "com.meteorapp.test",
"sha256_cert_fingerprints": [
<YOUR-SHA256>
]
}
}
]

Testing the association

This above file should be accessible with the URL, https://YourAppDomain.com/.well-known/assetlinks.json`

Creating Digital Asset Links in Meteor App

In MeteorJS you can create .well-known directory inside your public folder and you can add assetlinks.json inside this directory.

Now the question is,

How to get that SHA256 fingerprint?

This SHA256 fingerprint can be generated from the Keystore which is basically your app’s signing certificate

If you want to create a Keystore, you can follow this documentation

If you have the keystore file then you can generate this SHA256 Just by using this command

keytool -list -v -keystore my-app-key.keystore

You can copy that SHA256 and paste in assetlinks.json file

Note :- if you dont have access to this keystore, you can still get this SHA256 from the Google Play Console just go to Release > Setup > App integrity

How to Test Deep linking in your local environment?

Step 1: Get the SHA256 of your debug keystore

Whenever you run your app through android studio or directly using the command,

meteor run android-device

it will run your app in debug mode, and by default, it will use the debug keystore which can be found in .android folder which is present in your root directory,
for more information about the debug key, you can check this Official Documentation.

Get the SHA256 from debug keystore using the command,
keytool -list -v -keystore ~/.android/debug.keystore

and the password for this keystore is android . now we can use this SHA256 for testing deep links locally.

Step 2: Build your meteor app

For building your meteor app you can use the command

meteor build ../output --server=http://<IP-ADDR>:3000 --mobile-settings settings.json

and run the meteor app in another tab using the command

meteor run --settings settings.json --port http://<IP-ADDR>:3000

Note : Your phone should be connected to the same Wifi network and you need to enter your network ip address.

Here make sure your asset-links file is accessible with the URL,

http://<IP-ADDR>:3000/.well-known/assetlinks.json

Step 3: Open The build folder in android studio

Open android studio and open the folder output/android/project in android studio and select the device and run the app using the play button.

Step 4: Open Android App Links Assistant

In android studio on the top bar go to tools and then open the Android app link assistant,

This is a great feature in android studio to test our deeplinks.

If you go to the Open URL Mapping Editor you will see the universal links that you added in your mobile configs will be visible over here

Note: If your Links that you have entered in mobile configs are not visible in URL Mapping Editor then their might be some issue in build folder , you can try to reset the project using meteor reset and rebuild the app.

Step 5: Test your links

Now go to Test App Links section and enter the URL. this Url should be present in your URL mapping Editor. and finally, your link should open your app.

Still needs to be fixed? :(

Here are some steps to follow, if your deep links are still not working:

1 ) Cross-verify the SHA256 of your apk with the SHA256 generated by the keystore and which is in your .well-known . you can extract the SHA256 directly from the generated apk by using this command.

keytool -printcert -jarfile <apk-name>.apk

2) If you are testing on Android 12, open your app settings and inside app info check if your web links are verified.

Image from Android’s Official Documentation

In the development environment, you can manually verify those which check the checkbox or you can do it using ADB command you can refer and run the tests again.

3) If you are facing issues opening deep links in your deployed version
you can use this Statement List Generator and Tester to check if your Host grants app deep linking to your app.

That was all about Deep linking in the Meteor android app.

In the next part, we will discuss how to implement and test deep linking in the meteor ios app. Stay tuned for that!!!

--

--