Reputation: 145
I'm new to Android, still learning it, and I have a project that uses AndroidAnnotations, and want to implement App Links.
I read the documentation (here) and even read some questions here on Stackoverflow.
Following the documentation, the intent-filter inside the Manifest is:
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="real.host.here" />
<data android:scheme="https" android:host="real.host.here" />
</intent-filter>
The intent is inside an activity, and the only thing different from all the examples I found is that my activity is like this:
<activity
android:name=".activities.MainActivity_" ...>
<intent-filter...>...</intent-filter>
</activity>
Because of AndroidAnnotations, the name is ".MainActivity_", not "MainActivity".
Beside that, the hosted assetlinks.json is accessible by HTTPS connection, here is my file:
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "com.my.package.name",
"sha256_cert_fingerprints":["32:D9:9E:17:2E:C7:B4:82:12:96:C8:3E:D1:51:56:3F:7C:ED:97:69:F9:4A:39:54:4C:7B:AD:8A:AD:27:8F:45"]
}
}]
The SHA256 fingerprints is from the certificate I use to build the release version of the app.
I already tested with the Statement List Generator and Tester tool and the result is a success.
And just to be sure, I always test with the signed apk and the phone I'm testing it is an Android 6.0.
When I confirm the digital asset link files with this
https://digitalassetlinks.googleapis.com/v1/statements:list?
source.web.site=https://<domain1>:<port>&
relation=delegate_permission/common.handle_all_urls
I get this message:
... "debugString": "********************* ERRORS *********************\nNone!\ ...
But when I try this command
adb shell am start -a android.intent.action.VIEW \
-c android.intent.category.BROWSABLE \
-d "http://<domain1>:<port>"
It opens the browser, not the app.
I really would like to know what could be wrong here.
Upvotes: 1
Views: 2792
Reputation: 145
I found my own problem.
First I found that inside the intent-filter,
<action android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.category.BROWSABLE" />
should be
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
But even after that, it wasn't working. So I found the real problem.
See here:
<data android:scheme="http" android:host="real.host.here" />
<data android:scheme="https" android:host="real.host.here" />
The problem was, my host provides only an HTTPS protocol, there is no HTTP for my website. After I remove the "http" data line, it worked like a charm. There is no problem using the AndroidAnnotations.
Upvotes: 3