Android deep-links - Error 1024 when in debug/emulator - android

I have added my assetlinks.json to my website within the .well-known folder and confirmed the file is being served
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "com.******.*********",
"sha256_cert_fingerprints":
["23:DB:...."]
}
}]
I have added auto verify and data tags to the AndroidManifest.xml though as it is a capacitor application I wasn't 100% which intent-filter to add it to
<application>
<activity>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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"/>
<data android:host=*****.*******.com" />
</intent-filter>
</activity>
The deep linking works fine when I manually add it within the phone/emulator but does not seem to "auto verify".
I tried the following adb commands
adb shell pm verify-app-links --re-verify com.*****.*******
then
adb shell pm get-app-links com.****.*******
And get back
com.*****.******:
ID: b5eb46a8-eb37-44ff-8b50-c6bc92402d34
Signatures: [23:DB:....]
Domain verification state:
*****.*****.com: 1024
I suppose my first question is - Should I even expect this to work with the application running in debug (unpublished/signed) and if so - any help?

according to the android app, link documentation: Do not publish your app with dev/test URLs in the manifest file that may not be accessible to the public (such as any that are accessible only with a VPN). A work-around in such cases is to configure build variants to generate a different manifest file for dev builds.

Related

Android App Links on Android 12 - `legacy_failure`

I'm working on a React Native app that is supposed to open when you click on a link that leads to the website. The iOS and Android 10 versions work just fine.
However, on Android 12 instead of opening the app the link opens in the browser. I have .well-known/assetlinks.json file in place that looks like this:
[
{
"relation": [
"delegate_permission/common.handle_all_urls"
],
"target": {
"namespace": "android_app",
"package_name": "com.example",
"sha256_cert_fingerprints": [
"AA:BB:CC:DD:EE:FF...", // staging key fingerprint
"AA:BB:CC:DD:EE:FF..." // prod key fingerprint
]
}
}
]
I read this article through and through trying to find a solution to this.
I tried running adb shell pm verify-app-links --re-verify com.example and executing adb shell pm get-app-links com.example, but I keep getting the result:
Domain verification state:
example.com: legacy_failure
I also tried the Statement List Generator and Tester tool by Google. It says that there's no app deep linking permission on www.example.com, but after a few more tries it shows success.
My AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example">
<application ...>
<.../>
<activity ...>
<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"/>
<data android:host="example.com" />
</intent-filter>
<.../>
</activity>
<.../>
</application>
</manifest>
I tried changing android:host to www.example.com or *.example.com but that didn't seem to work either.

Android App Link - Testing the flow in local environment

I'm trying to check how App Links work on android.
Here is what I have done so far -
Set up a local server with MAMP, apache points to port 80.
Created .well-known in the htdocs & also put the assetlinks.json in the created dir.
I am able to access it using - http://192.168.0.78/.well-known/assetlinks.json
where 192.168.0.78 is my lan ip. I generated the SHA using the keytool command.
Here are the contents of the file assetlinks.json:
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "com.pbc.deeplinking_demo",
"sha256_cert_fingerprints":
["D9:29:00:B9:30:F1:24:A0:E7:7A:58:74:43:C6:06:FF:F6:16:BB:42:F3:A2:16:10:5D:81:27:37:3A:E5:A6:14"]
}
}]
Set up an android app with the applicationId : com.pbc.deeplinking_demo
Added the intent-filters with autoVerify=true to the activity
implementation below -
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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" />
<data
android:host="192.168.0.78" />
</intent-filter>
</activity>
With this config, I continue to see the disambiguation dialog asking me to choose between the default browser and the target app.
Note: I am able to access the mamp page & also the assetlinks.json from Chrome on Android emulator.
Am I missing something here or is it not possible to test this in local environment?

Deeplink not work for some messaging app in Android

I am developing an android app.
It uses AppsFlyer's Onelink kind of a Deeplink.
I set up and tested, in general, it works fine.
When I tested this using Android studio, it works fine
When I tested this with Slack messenger, it works fine too.
But If I test this with other messaging apps, it doesn't work, and just open the web browser.
I don't know why and how to fix it.
<intent-filter
android:autoVerify="true"
android:label="#string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="mylink.com"
android:pathPrefix="/path"
android:scheme="https" />
</intent-filter>
For deep linking to work in Android 12, you need to create intent-filters with 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" />
<data android:scheme="https" />
<data android:host="www.example.com" />
<data android:host="mobile.example.com" />
</intent-filter>
Host a Digital Asset Links JSON on your website at the below location to declare the association between your intent filters and the website.
https://your-domain.name/.well-known/assetlinks.json
assertlinks.json should contain the following information
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "your.app.package.name",
"sha256_cert_fingerprints": ["14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5"]
}
}]
You can generate sha256_cert_fingerprints using java key tool
keytool -list -v -keystore my-release-key.keystore
If you're using Play App Signing, You can find Digital Asset Links JSON snippet at the following location Release > Setup > App Integrity

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.

Android App Deeplinking using assetlinks.json

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.

Categories

Resources