In my application I want to use app links.
For this in my AndroidManifest.xml I am defining activity as :
<activity
android:name="com.abc.xyz.DeepLinkActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.Transparent">
<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="*.example.com"
android:scheme="https"/>
<data
android:host="*.example.com"
android:scheme="http"/>
</intent-filter>
</activity>
and for this I am defining assetlinks.json as :
{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "com.abc.xyz",
"sha256_cert_fingerprints": ["10:0C:0C:C2:78:EA:3B:DA:CA:A3:43:57:D1:8B:EE:62:15:E6:08:99:77:F1:F7:F1:DF:9E:DF:3C:92:04:B8:62"]
}
}
where fingerprint is defult android debug keystore fingerprint.
Only thing to point is that we are hosting assetslink.json at https://www.example.com/.well-known/assetlinks.json domain and not at
https://example.com/.well-known/assetlinks.json domain.
Can it be the cause. I seem to have been following all the guideline present at
https://developer.android.com/training/app-links/verify-site-associations.html#request-verify
As pointed out here android doesn't handle wildcards, so you should probably change
<data
android:host="*.example.com"
android:scheme="https"/>
to
<data
android:host="example.com"
android:scheme="https"/>
You can also use https://developers.google.com/digital-asset-links/tools/generator to test if site verifies your app.
Related
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?
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
Trying to upload instant application but getting this error
You should have at least one active APK that is mapped to site 'sample.com' via a web 'intent-filter'.
<activity
android:name=".ui.InstantSplash"
android:screenOrientation="portrait"
android:theme="#style/splashScreenTheme">
<meta-data
android:name="default-url"
android:value="https://sample.com/base-app/salt_one" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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:scheme="http" />
<data android:host="sample.com" />
<data android:pathPrefix="/base-app" />
<data android:scheme="https" />
</intent-filter>
</activity>
Upload installable APK in alpha, beta or production with same HOST web 'intent-filter'.
You are defining an Intent filter with the scheme and host:
<data android:scheme="http" />
<data android:host="sample.com" />
so you have to access your deep links with
http://sample.com
but this domain must be a valid domain, and this domain must be of your property because you need to add the assetlinks.json
The website www.example.com publishes a statement list at
https://www.example.com/.well-known/assetlinks.json. This is the
official name and location for a statement list on a site; statement
lists in any other location, or with any other name, are not valid for
this site. In our example, the statement list consists of one
statement, granting its Android app the permission to open links on
its site:
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target" : { "namespace": "android_app", "package_name": "com.example.app",
"sha256_cert_fingerprints": ["hash_of_app_certificate"] }
}]
Read more about it:
https://developers.google.com/digital-asset-links/v1/getting-started#quick-usage-example
Instant apps does not support HTTP. Your default-url should be HTTPS
<meta-data
android:name="default-url"
android:value="https://sample.com/base-app/salt_one" />
Your app must also define a default URL for your app. Within the same Android manifest as your entry-point activity, you define the default URL for your app by adding a element with a value attribute that provides a valid HTTPS URL that the activity can handle. Further, this default url must also be part of the CATEGORY_LAUNCHER activity's intent filter in the installed app.
The following code snippet shows an Android manifest that defines an entry-point activity and default URL for an instant app.
<activity
android:name=".MainActivity">
<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:scheme="https" />
<data android:host="example.com" />
</intent-filter>
<meta-data
android:name="default-url"
android:value="https://www.example.com/index.html" />
</activity>
Instant apps does not support HTTP. Your default-url should be HTTPS
For more details can you check android AIA documentation.
There is some inappropriate string for error message, can you ensure fix with, installable APK in alpha, beta or production with same HOST web 'intent-filter'.
When i publish preview version, play store tip:
You must use at least one APK that maps to the "example.com" site via the network "intent-filter".
It no problem on develop version.
<activity android:name=".MainActivity">
<meta-data
android:name="default-url"
android:value="https://example.com/"/>
<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:host="example.com"
android:pathPattern="/"
android:scheme="https"/>
<data android:scheme="http"/>
</intent-filter>
</activity>
because it is the test phase, so the online version of the installation App has not added default url. add default-url to installation App manifest.xml it will be ok.
I am implementing Deep-linking in my android application. I have added the properties mentioned here but still I am not getting any logs while debugging neither its working for my application.
My manifest is looking like:
<activity
android:name=".activities.HomeActivity"
android:configChanges="orientation|screenSize"
android:exported="true"
android:label="#string/app_name"
android:launchMode="singleInstance"
android:noHistory="false"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter android:autoVerify="true">
<data android:host="domain" android:scheme="https" />
<data android:host="domain" android:scheme="http" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
I am testing on a device having api level 23. But still its not working. Any help will be really appreciated.
I have placed following file on my server:
I have created a directory named ".well-known" and then saved the file having content given below with name "assetlinks.json"
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target" : { "namespace": "android_app",
"package_name": "package-name",
"sha256_cert_fingerprints": ["fingerprints"] }
}]
But still neither getting any logs, nor its working.