Android: intent filter verification failure

风流意气都作罢 提交于 2020-12-31 09:49:29

问题


My goals is to have Android automatically open any link that starts with test.touchwonders.com in my app. I have place the required file on my server: https://test.touchwonders.com/.well-known/assetlinks.json

This is the relevant part of my manifest:

    <application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme"
    android:name="com.justbrands.highstreet.pmelegend.PmeApplication">
    <activity
        android:name="com.highstreet.core.activity.MainActivity"
        android:label="@string/app_name" >
        <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="test.touchwonders.com" />
            <data android:host="www.test.touchwonders.com" />
        </intent-filter>

        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="pme-legend"/>
        </intent-filter>

    </activity>
</application>

When installing the app, however, this is the output I see in logcat:

06-27 09:48:43.267 6488-6488/? D/IntentFilterVerRcvr: Received ACTION_INTENT_FILTER_NEEDS_VERIFICATION.
06-27 09:48:43.276 6488-8080/? I/IntentFilterIntentSvc: Verifying IntentFilter. verificationId:14 scheme:"https" hosts:"test.touchwonders.com www.test.touchwonders.com" package:"com.justbrands.highstreet.pmelegend.acceptance".
06-27 09:48:43.531 6488-8080/? I/IntentFilterIntentSvc: Verification 14 complete. Success:false. Failed hosts:test.touchwonders.com,www.test.touchwonders.com.

My device uses the Charles proxy which allows you to see requests. I see no requests going out to test.touchwonders.com tough. I used adb shell pm clear com.android.statementservice beffore installing, which should have cleared the cache and forced a re-fetch of the json.


回答1:


I had the same problem and the problem was not related to assetlinks.json file. I had 3 different domains and one of them was failing to due some misconfiguration. Even if only one domain was failing, applink was not working for other domains either. You may want to check if all the domains are working as expected.




回答2:


It turned out the problem was not in my app, but in the assetlinks.json file on the website's server. In my case the problem was that the MIME type oft he server's response was not application/json My real problem was that I did not have a method of testing my assetlinks file. I have found one in the meantime:

Refer to https://developer.android.com/training/app-links/index.html#testing

and use the testing url

https://digitalassetlinks.googleapis.com/v1/statements:list?
source.web.site=https://<domain1>:<port>&
relation=delegate_permission/common.handle_all_urls


来源:https://stackoverflow.com/questions/38048936/android-intent-filter-verification-failure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!