Android App Deeplinking using assetlinks.json - android

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.

Related

Android app links intent-filter with wildcard subdomain not verified

I have app links in my app for two subdomains.
Assetlinks.json is already placed in our host's well-known directory and returns proper json.
When I use the following intent-filter, everything works fine.
<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="www.example.com" />
</intent-filter>
Verifying IntentFilter. verificationId:27 scheme:"https"
hosts:"www.example.com" package:"com.example.seven". [CONTEXT
service_id=244 ] Verification 27 complete. Success:true. Failed
hosts:. [CONTEXT service_id=244 ]
But when I try to set up our intent filter for multiple subdomains 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:scheme="https" android:host="*.example.com" />
</intent-filter>
The verification is never passed: Verifying IntentFilter.
verificationId:26 scheme:"https" hosts:"example.com"
package:"com.example.seven". [CONTEXT service_id=244 ] Verification 26
complete. Success:false. Failed hosts:example.com. [CONTEXT
service_id=244 ]
Has anyone experienced this issue and what can be done?
Thanks in advance!
So the problem was, that assetlinks.json was stored under
www.example.com/.well-known/
which turned out to be a different place from
example.com/.well-known/
Using wildcard subdomain app tried to verify 2 domains:
www.example.com and example.com. And failed with the second, what failed the verification in general.
Basically, www.example.com/.well-known/assetlinks.json was reached via chain of redirections
This is why it seemed to me, that example.com/.well-known/assetlinks.json was present.
And app links documentation says:
The assetlinks.json file must be accessible without any redirects (no
301 or 302 redirects).
So if you want to use wildcard subdomains, make sure to locate your assetlinks.json
under exactly example.com domain.

Android app link not working and not appearing in adb dumpsys

I'm trying to set up android app link for my add but they are not working.
I modified my manifest.xaml (android/app/src/main), by adding :
<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="example.com" />
<data android:scheme="https" />
</intent-filter>
and added a assetlinks.json to my website (./well-known/assetlinks.json).
And when i validate it by browsing on https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://example.com&relation=delegate_permission/common.handle_all_urls, it says there is no errors but my app link is not working when i open it with adb shell am start -a android.intent.action.VIEW -d "https://example.com"
When i try to find the app link with adb shell dumpsys package domain-preferred-apps, it says it does not exists.
I aldready verified my sha256 key and my app package on the assetlinks.json...
Can someone please help me :)

Import APK on Play Store

I have some difficulties while importing my first APK on Play Store. A simple WebView App.
I have this error message :
Importation error.
The domain name "https://chimeria.net" you specified is not valid
Enter a valid domain name.
Where https://chimeria.net is the url of the embeded website in the WebView...
After the documentation I read (https://developers.google.com/digital-asset-links/v1/getting-started):
I created a json file at
https://chimeria.net/.well-known/assetlinks.json
I took the SHA256 value from My Developer play store page, at the tab Application Signature.
screenshot of where i picked up the SHA546 KEY
I added this line in the AndroidManifest.xml of the app:
<meta-data android:name="asset_statements" android:resource="#string/asset_statements" />
I added this in the res/values/strings.xml file of the app
<string name="asset_statements">
[{
\"relation\": [\"delegate_permission/common.share_location\"],
\"target\": {
\"namespace\": \"web\",
\"site\": \"https://chimeria.net\"
}
}]
</string>
Later in my manifest file, I declared
<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="https://chimeria.net" />
<data android:scheme="https" />
</intent-filter>
The app was created with Android Studio (Android App Bundle) that gave me an .aab file.
No matter what I tried, my app was refused because the link was not accepted.
And finnaly I wasted all possible attemple in a day.
Would somebody know what I am doing wrong ?
Thanks you for your help
chimeria.net is the host, https or http is the scheme.
You probably want to change your manifest to:
<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="chimeria.net" />
<data android:scheme="https" android:host="chimeria.net" />
</intent-filter>

Android app links have been verified. But, still disambiguation dialog shows up

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

Linking app through Digital Asset Link protocol

My problem is that uploading my signed APK for my android instant app to google play console gives me the following error:
Your site 'anam-instant.mybluemix.net' 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.
I have a single base module, with the AndroidManifest.xml intent filter as follows:
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter
android:autoVerify="true"
android:order="1" >
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="https" />
<data android:scheme="http" />
<data android:host="MYURL.net" />
<data android:pathPrefix="/hello" />
</intent-filter>
<meta-data
android:name="default-url"
android:value="https://MYURL.net/hello"/>
At /.well-known/assetlinks.json
[
{
relation: [
"delegate_permission/common.handle_all_urls"
],
target: {
namespace: "android_app",
package_name: "com.example.anam.my_instantapp",
sha256_cert_fingerprints: ["SHA256-CERT"]
}
}
]
I have Google app signing enabled and got my sha256 cert from there, using the Upload certificate.
I have verified that the package name is the same as the package name in the base module's AndroidManifest.xml.
I have verified that my robots.txt allows all.
I'm trying to release this under Instant app development.

Categories

Resources