Expample | |
---|---|
App link | https://example.web.app |
Package Name | com.example.android |
Overview
Questions about the development of AppLink.
Deploy .well-known/assetlinks.json
, and now viewable via digital link(ex. https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://example.web.app&relation=delegate_permission/common.handle_all_urls
)
The fllowing is its json:
{
"statements": [
{
"source": {
"web": {
"site": "https://example.web.app."
}
},
"relation": "delegate_permission/common.handle_all_urls",
"target": {
"androidApp": {
"packageName": "com.example.android",
"certificate": {
"sha256Fingerprint": "xxx"
}
}
}
}
],
"maxAge": "3596.313666292s"
}
Then, in Android emulator, I tried to open by adb
command.
Of course, we also set the intent-filter, in AndroidManifest.xml
.
<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.web.app" />
<data android:scheme="https" android:host="example.web.app" />
adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "https://example.web.app"
But it simply opened the browser, but not the app.
Then, I tried the URL with a dot(.
) at the end and succeeded in opening the app!
adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "https://example.web.app."
AndroidManifest.xml
Add dot at the end
<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.web.app." />
<data android:scheme="https" android:host="example.web.app." />
I want to make a successful transition to the application without a trailing dot, any good solution?
Pardon my poor English.
Thank you.
Environment
Native App
- Flutter: 3.13.5
Web Hosting
- Firebase Hosting
Web Frontend
- Next.js: 13.4.7
Setting Files
// public/.well-known/assetlinks.json
[
{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "com.example.android",
"sha256_cert_fingerprints": ["xxx"]
},
}
]
// firebase.json
{
"hosting": {
"source": ".",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"headers": [
{
"source": "/.well-known/apple-app-site-association",
"headers": [
{
"key": "Content-Type",
"value": "application/json"
}
]
},
{
"source": "/.well-known/assetlinks.json",
"headers": [
{
"key": "Content-Type",
"value": "application/json"
}
]
}
],
"frameworksBackend": {
"region": "asia-east1"
}
}
}
Note
I think I have done the required settings.
- Deploy
.well-known/assetlinks.json
- Add SHA256 fingerprint
- See statements list in https://digitalassetlinks.googleapis.com/...
- Add
intent-filter
- android:autoVerify="true"
- Flutter run, in release build