I'm using branch.io in my project for deep-linking. On click of the deep-link, the app is not getting launched directly instead it's showing the list of apps. Then I need to click my app in order to open it. I'm testing on Oreo(API level 27) device. Below is a piece of manifest code.
<intent-filter
android:autoVerify="true"
tools:targetApi="m">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="xxx-alternate.app.link"
android:scheme="https" />
<data
android:host="xxx.test-app.link"
android:scheme="https" />
<data
android:host="xxx.app.link"
android:scheme="https" />
</intent-filter>
There are a few things to ensure for a deeplink to directly open your app:
The intent-filter for the App link has the autoverify option set to true (which I see is set in your case)
The SHA-256 key you have uploaded on the Branch dashboard is the same SHA-256 key that is used to sign your APK file. (Make sure if you are testing against a debug build to use the SHA-256 key from the debug keystore)
If correctly setup, the app link should correctly open your app. This behavior was updated since Android API level 23 and above.
You can check if the link domain is correctly linked to your application here. On entering the details and clicking Test Statement it should state "Success! Host <your domain> grants app deep linking to <App Package Name>" if correctly linked.
PS: If you update your SHA-256 key on Branch dashboard, it might take a few hours for Google to scrap the asset-link file hosted by Branch.
Related
I have hosted assetlinks file into our domain https://ourdomain/.well-known/assetlinks.json And also verified this using https://developers.google.com/digital-asset-links/tools/generator and from android studio's App Links Assitant and got verified status from both the ways.
But when i am sharing debug APK for testing it's always opening in browser.
I also tried uploading on app store and downloaded from there for testing but it always open in browser.
Note: for debug build used my laptop SHA-256 and once app live on play store changed SHA ( got SHA-256from By going to Application Dashboard in Play Console then Release Management --> App Signing ) on hosted assetlinks file into our domain https://ourdomain/.well-known/assetlinks.json
Below is the code used in the manifest file.
<intent-filter android:autoVerify="true">
<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="abc.test.com" />
</intent-filter>
Deep-links are working in Android 11 or before but on Android 12 it isn't.
But even after adding assetlinks.json file and adding all the intent-filters. Android 12 still isn't detecting deep-links. In Android-Manifest file turns out that scheme's tag is need to be separated from the data tag like this:
// OLD - Which is only working Android 11 or before
<data
android:host="domain.name"
android:pathPrefix="/videos"
android:scheme="https" />
// NEW - Which is working on all including Android 12
<data android:scheme="https" />
<data
android:host="domain.name"
android:pathPrefix="/videos" />
You need to add deep link verification.
See https://doordash.engineering/2022/01/25/your-deep-links-might-be-broken-web-intents-and-android-12/
I have same problem and solved by going to app info setting -> set as default ->support web addresses and you will see your short link
so turn it on and it will work ;)
Update:
as every one said its not a programmatically way so the best way is that link below said
In my case, the app is working in android 11, but it doesn't work in android 12 when the app is compiled and built with android studio.
I tested the production app; it works fine with the app link.
For development build, I have to go to App info -> Open by default -> Add link -> check off all the available links
This seems only happen with development builds; the apps installed from Google app store automatically has all the links selected.
In my case problem was with inconsistent between SHA Signatures in store build and https://ourdomain/.well-known/assetlinks.json, that's why deep links were disabled by default on Android 12, for fixing it we can connect our phone with problem build to Android studio and run this command:
adb shell pm get-app-links com.your_app_package_name
as a result you should see something like this:
com.your_app_package_name:
ID: .....
Signatures: [AB:CD:EF:HI:GK...]
Domain verification state:
your_domain.com legacy_failure
next you need to check whether the signature fingerprints is included in your https://ourdomain/.well-known/assetlinks.json, in my case it doesn't,
also keep in mind that in assetlinks.json file can be couple of signatures for example for debug, alpha, beta and production builds, it should looks like below:
[
{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "com.your_app_package_name",
"sha256_cert_fingerprints" :["DE:BU:GS:HA:25:6...","PR:OD:SH:A:25:6..."]
}
}
]
After adding assetlinks.json in domain you have to reinstall app (just uninstall the app and install again) that will work
This fixed it for me:
<intent-filter
android:autoVerify="true"
>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="my.page.link" />
<data android:scheme="https" />
</intent-filter>
Notice: android:autoVerify="true"
The weird thing about this is only broke on certain Android phones, and wasn't necessarily consistent across API versions. Pixel 4 on API 33 worked fine without this fix and didn't work with Pixel 6 on API 33. What can ya do.
In my case after doing the above (debug/release SHA-256 keys in assetlinks, separate the scheme tag) the final culprit turned out to be the "path" tag. For some reason the verification process does not include the tag even though this has always been there in the app and used to work prior to Android 12. Not a big deal in my app since I was ignoring the path anyway.
Before (not working):
<data android:host="dl.example.com"
android:path="/test" />
<data android:scheme="https" />
After (working):
<data android:host="dl.example.com"/>
<data android:scheme="https"/>
Hope it helps someone
Follow these steps:
Step 1:
Add android:autoVerify="true" to your intents-filter.
Step 2:
Move the android:scheme to separate data tag
So now your intents-filter in manifest looks like this:
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="websiteUrl"
android:pathPrefix="/" />
<data
android:scheme="https" />
<!-- note that the leading "/" is required for pathPrefix-->
</intent-filter>
Step 3:
Add your Digital Asset Links JSON file to following url:
https://{yourdomain.name}/.well-known/assetlinks.json
Note:- For production app make sure you use the digital asset links JSON file generated by Play console. You can find it at
Play console -> Your App -> Setup (Side menu option) -> App Integrity -> App signing (scroll to the bottom)
Step 4:
Verify that all the steps are correctly implemented by manually running app link validation using these commands - https://developer.android.com/training/app-links/verify-android-applinks#manual-verification
Step 5:
If your links were shown as verified in step 4 then now install the app on device and wait for atleast 2-3 minutes before clicking on any app links because in this time Android will verify your app links by reading your manifest file and the digital assets JSON file that you uploaded on your website.
After you have waited 2-3 minutes, now you can click on your app link and it should open your app.
Hope this helps!
Before Android 12, Deep link followed the standard implementation with the code in the Manifest:
<intent-filter>
<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="www.yourdomain.dev"
android:pathPrefix="/set/v1" />
After Android 12, we have to add autoVerify to the intent-filter:
<intent-filter android:autoVerify="true" tools:targetApi="m">
And the website must be verified by adding assetlinks.json to the .well-known directory in your website (same as Apple does)
But, most important, you can only test this building and signing the app:
Build -> Generate Signed Bundle/APK
during development, you can test your implementation manually enabling the link in the app on your device
I'm trying to to setup a Digital asset link from my website to my app, but I can't get it to work. I made sure the intent-filter was present in my manifest and I uploaded a assetlinks.json file using my Play store signing SHA 256 fingerprint, tested it with Google's statement list and it returned successfuly.
While going through verification steps again, I checked my device's app links with adb -d shell pm get-app-links --user current com.example.app and I realized that my app link didn't have a signature. I'm guessing that's its probably the reason the app can't link to my website since it can't compare a signature to the fingerprints given in the assetlinks.json hosted on my site's server.
My app link
com.example.app 01234567-89ab-cdef-0123-456789abcdef:
User 0:
Verification link handling allowed: true
Selection state:
Enabled:
com.example.app
Compared to another
com.google.android.youtube:
ID: 01234567-89ab-cdef-0123-456789abcdef
Signatures: [<has-some-SHA256-certificate-fingerprints-here>]
Domain verification state:
youtu.be: system_configured
m.youtube.com: system_configured
youtube.com: system_configured
www.youtube.com: system_configured
User 0:
Verification link handling allowed: true
Selection state:
Disabled:
youtu.be
m.youtube.com
youtube.com
www.youtube.com
For some reason, my app link doesn't have the same format as most of the other links, more importantly doesn't have a signature, and I can't figure out why. However I tried installing it, it always gave the same results. I tried installing it:
From the Play store's internal testing
From a signed apk downloaded from the App bundle explorer
From the signed apk we normally upload to the Play store
From a manually signed apk built on my local machine
Has anyone any idea what I'm missing?
I managed to find the solution to my problem. Turns out my intent-filter had multiple empty data tags which seemed to prevent my app to detect the website.
I forgot to specify that I'm my app's AndroidManifest is built by Cordova since I'm using Ionic. So I cannot edit my AndroidManifest directly. I have to use the ionic-plugin-deeplinks plugin.
The problem is, the ionic plugin generates an intent-filter with the data given in the package.json with the following format.
"cordova": {
"plugins": {
"ionic-plugin-deeplinks": {
"URL_SCHEME": "my-url-scheme",
"DEEPLINK_SCHEME": "https",
"DEEPLINK_HOST": "com.example.app",
"ANDROID_PATH_PREFIX": "/",
"ANDROID_2_PATH_PREFIX": "/",
"ANDROID_3_PATH_PREFIX": "/",
"ANDROID_4_PATH_PREFIX": "/",
"ANDROID_5_PATH_PREFIX": "/",
"DEEPLINK_2_SCHEME": " ",
"DEEPLINK_2_HOST": " ",
"DEEPLINK_3_SCHEME": " ",
"DEEPLINK_3_HOST": " ",
"DEEPLINK_4_SCHEME": " ",
"DEEPLINK_4_HOST": " ",
"DEEPLINK_5_SCHEME": " ",
"DEEPLINK_5_HOST": " "
}
}
}
This format is automatically generated by the plugin and adds multiple host/scheme/prefix to allow support of multiple addresses. However I'm using only one address, so when I'm generating the AndroidManifest with the plugin, it generates an intent-filter with many empty data tags in it.
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="com.example.app" android:pathPrefix="/" android:scheme="https" />
<data android:host=" " android:pathPrefix="/" android:scheme=" " />
<data android:host=" " android:pathPrefix="/" android:scheme=" " />
<data android:host=" " android:pathPrefix="/" android:scheme=" " />
<data android:host=" " android:pathPrefix="/" android:scheme=" " />
</intent-filter>
As of now the only way I managed to remove the extra data tags was to fork the plugin's repository and remove the package.json extra properties from the plugin. It looks like this:
"cordova": {
"plugins": {
"ionic-plugin-deeplinks": {
"URL_SCHEME": "my-url-scheme",
"DEEPLINK_SCHEME": "https",
"DEEPLINK_HOST": "com.example.app",
"ANDROID_PATH_PREFIX": "/"
}
}
}
Which generates this intent-filter that is working has intented:
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="com.example.app" android:pathPrefix="/" android:scheme="https" />
</intent-filter>
This might help other people, but I made 2 intent filters:
One with http/s only data tags and
The other with my app's name as the scheme.
It didn't seem to work when the custom theme was bundled under one intent filter.
I might just have solved something like this. Things to check:
Please note, i'm only using imgur.com as an example, I'm not affiliated/working for them in any way.
Check your assetlinks.json, and compare it to a working one (e.g. https://imgur.com/.well-known/assetlinks.json). You could also test your file like so: https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://imgur.com&relation=delegate_permission/common.handle_all_urls
Next, check your AndroidManifest.xml, and ensure that the attribute android:autoVerify="true" is set on the intent-element (By mistake, I've declared mine on the activity-element) which caused same problem as above):
<activity android:name=".MainActivity">
<intent-filter android:autoVerify="true">
<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="imgur.com" />
</intent-filter>
</activity>
Next, build a signed .apk (use the same keystore to sign your .apk with, as you've used to set the footprint in the assetlinks.json file - i.e. $ keytool -list -v -keystore myapp.keystore), and install that into the emulator. Something like this (uninstall app from emulator first):
$ adb install /myapp/app-release.apk
$ adb shell
: pm get-app-links com.myapp.app
Also, this reference page is handy while working with this: https://developer.android.com/training/app-links/verify-site-associations#manual-verification -- hope this helps!
When I click on the link: https://example.com/abcd on android version 6/7/8 it shows disambiguation dialog. We have already verified domain by placing json at: https://example.com/.well-known/assetlinks.json. I've done everything as per the documentation and still the link doesn't open without disambiguation. Please help me find what I'm missing.
Code in manifest:
<intent-filter android:autoVerify="true">
<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="example.com"
android:pathPattern="/abcd"
/>
</intent-filter>
Late to the party but I too experienced the disambiguation always popping up. For those who haven't managed to resolve this yet (or to come), go to Logcat and search for "IntentFilterIntentOp". You should be seeing something like Verification 8 complete. Success:true. Failed hosts:. This may fail (Verifying IntentFilter. verificationId:8 scheme:"https" hosts:"example.co.za" package:"za.co.example.qa".) if you've uploaded your assetlinks.json file to one domain whilst it's not accessible on other or subdomains that you've registered in your intent-filter.
It's also worth mentioning that your App would have to have been launched at least once before in order for "IntentFilterIntentOp" to perform the necessary verification. Accessing a link via App Link Testing in Android Studio should thereafter automatically open your app without the disambiguation dialog.
update as of 2021 with Android 12:
Android changed web intent resolution policy that effects link handling, if you follow all the new requirements your app will be given a chance if not browser will handle those, more on this here:
web intent resolution requirements
/////////////////////Below behavior might still apply today//////////////////////
The Caveat here is if you install the app through playstore the default "link-handling policy" of the application with registered domains like www.example.com is set to "Handle in the app", which will open the app directly subject to intent filter verification without any disambiguation dialogues.
If you install the app by means other than playstore like through adb even though you sign it with keystore the default link handling policy is set to "Always ask" which will show disambiguation dialog even though the intent-filter verification passes for your app link.
Please try to add autoVerify="true":
<intent-filter android:autoVerify="true">
<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="example.com"
android:pathPattern="/abcd"
/>
you can try like this, both http and https:
<activity
android:name=".ui.MainActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="www.oschina.net"
android:scheme="http" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="www.oschina.net"
android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="my.oschina.net"
android:scheme="http" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="my.oschina.net"
android:scheme="https" />
</intent-filter>
</activity>
Got the same issue. Take a look at your sha256 fingerprint. If you test applinks with debug version of the app then you have to place the fingerprint for debug version. You can do it in Android Studio - Tools - App Links Assistant - Associate website.
When you run your app with Android studio, it is installed a debug APK on your device which might match the live config (which is for release APK or bundle) on your branch dashboard.
To handle de the debug (or test) mode in branch this is what I did
Setup test configuration in your branch dashboard:
On the top left on the dashboard there is a switch to access the test mode, click on it and fill the form for the test config.
Next create a debug link. The field values should be the same as for a live (release) mode link. the only difference the generated test link contains a prefix
yourapp.test-app.link/xxxxx
Create two Android manifest files for each type of APK or bundle:
app/src/debug/AndroidManifest.xml <- for debug APK or bundle
app/src/main/AndroidManifest.xml <- for release APK or bundle
Do the Branch SDK setup on both two manifest files
You should now be able to use the debug link without the disambiguation prompt showing
UPDATE: 20170703
Using Android Studio 3.0 Canary 5
Modified some AndroidManifest and build.gradle files,
Moved from inside to inside for both Base's AndroidManifest and App's AndroidManifest, like below:
<application ...>
<meta-data android:name="asset_statements" android:resource="#string/asset_statements" />
<activity ...>
</application>
resource asset_statements:
<string name="asset_statements">[{\n \"relation\": [\"delegate_permission/common.handle_all_urls\"],\n \"target\": {\n \"namespace\": \"web\",\n \"site\": \"https://example.com\",\n }\n}]</string>
The web verification is passed successfully (see screenshot below), uploaded new APK and ZIP (Instant App) but still same problem of can't rollout the Instant App.
Contacted google playstore support through "live chat", promised will get back but still no response after a few days.
------ OLD POST BELOW -------
I am using Android Studio 3.0 Canary 4 (preview).
Both Installable APK and Instant App (zip) are already uploaded successfully.
The Installable APK is already rolled out.
The Digital Assets Link json file already uploaded and verified in https://example.com/.well-known/assetlinks.json
I have only 1 Base module (feature module), inside the Base's AndroidManifest have only 1 activity:
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="#style/AppTheme"
>
<activity
android:name="com.example.test.app.base.activity.MainActivity"
android:configChanges="locale|layoutDirection|orientation|keyboardHidden|screenSize"
android:windowSoftInputMode="adjustResize"
android:launchMode="singleTop"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data
android:name="default-url"
android:value="https://example.com/instantapp/.*" />
<meta-data
android:name="asset_statements"
android:resource="#string/asset_statements" />
<intent-filter android:order="1" android:autoVerify="true">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="example.com" />
<data android:pathPattern="/instantapp/.*"/>
</intent-filter>
</activity>
</application>
My assets_statements define in /res/string.xml :
<string name="asset_statements" translatable="false">
[{
\"include\": \"https://example.com/.well-known/assetlinks.json\"
}]
</string>
So currently I believed every thing should be working fine because any configuration problem will be filtered when upload in Google Playstore, currently I can not rollout my Instant App because error :
Errors
Resolve these errors before starting the rollout of this release.
Your site 'mysite.com' has not been linked through the Digital Assets Link protocol to your app. Please link your site through the Digital Assets Link protocol to your app.
Warnings
Check these warnings before starting the rollout of this release.
NOTE: example.com is only to replace my real domain.
Please help me to understand what is wrong and how to solve it ?
If you are using Google Play App Signing then your local keystore contains the Upload Key, which is different than the App Signing Key.
In that case, the SHA256 fingerprint obtained with keytool is not the one you should include the Digital Assets Link json file.
The correct SHA256 fingerprint can be obtained in the Google Play Console, under Release Management / App Signing / App signing certificate.
Play Console Screenshot
You need to use path pattern in your deep link:
Make sure you are using your actual domain instead of example.com
https://example.com/instantapp
I am trying to link my app to url, so that it will open the app directly without selector option.
I added below code in android manifest file
but still it is not opening app directly.
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="domain.com" />
<data android:scheme="https" android:host="domain.com" />
</intent-filter>
After app installation I check I ran below command
adb shell dumpsys package domain-preferred-apps
but still it is showing status undefined for my app package.
Package: <"package name">
Domains: <"domain.com">
Status: undefined
Setting up the Manifest is only half of this process — you also need to do some configuration on your server so that Android can link the two together.
This article explains the steps. Basically you need to create an applinks.json file with your SHA256 fingerprint and then serve that over HTTPS from your domain without any redirects.