2016-03-25 2 views
3

私のアプリでは、MainActivity、SecondaryActivity、およびTertiaryActivityという3つのアクティビティがあります。私はSecondaryActivityをthis guideで説明されているように、Android 6の特定のドメインのデフォルトのアプリリンクハンドラにします。同時に、別のドメインのリンクを処理できるようにする別のアクティビティTertiaryActivityが必要ですが、ドメインを所有していないので、デフォルトのハンドラではありません。ここで説明するために私のAndroidManifestです:アンドロイドにもかかわらずAndroidがホストを検証しようとしています:autoVerify = "false"

<?xml version="1.0" encoding="utf-8"?> 
<manifest package="com.antonc.applinktest" 
      xmlns:android="http://schemas.android.com/apk/res/android"> 

    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:supportsRtl="true" 
     android:theme="@style/AppTheme"> 
     <activity 
      android:name=".MainActivity" 
      android:label="@string/app_name" 
      android:theme="@style/AppTheme.NoActionBar"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN"/> 
       <category android:name="android.intent.category.LAUNCHER"/> 
      </intent-filter> 
     </activity> 

     <activity android:name=".SecondaryActivity" 
        android:label="@string/app_name" 
        android:theme="@style/AppTheme.NoActionBar"> 
      <intent-filter android:autoVerify="true"> <!-- TRUE --> 
       <data android:scheme="https" 
         android:host="secondary.com"/> 
       <action android:name="android.intent.action.VIEW"/> 
       <category android:name="android.intent.category.DEFAULT"/> 
       <category android:name="android.intent.category.BROWSABLE"/> 
      </intent-filter> 
     </activity> 

     <activity android:name=".TertiaryActivity" 
        android:label="@string/app_name" 
        android:theme="@style/AppTheme.NoActionBar"> 
      <intent-filter android:autoVerify="false"> <!-- FALSE --> 
       <data android:scheme="https" 
         android:host="tertiary.com"/> 
       <action android:name="android.intent.action.VIEW"/> 
       <category android:name="android.intent.category.DEFAULT"/> 
       <category android:name="android.intent.category.BROWSABLE"/> 
      </intent-filter> 
     </activity> 
    </application> 

</manifest> 

私はAndroid上のアプリのリンク処理とアプリの確認の仕組みを説明し、ここで私はアプリの確認に関連logcatに表示メッセージだアプリリンク上でこのextensive guideを読ん:

03-25 17:54:45.640 1481-1481/com.google.android.gms D/IntentFilterVerificationReceiver: Received ACTION_INTENT_FILTER_NEEDS_VERIFICATION. 

03-25 17:54:45.644 1481-30947/com.google.android.gms I/IntentFilterIntentService: Verifying IntentFilter. verificationId:12 scheme:"https" hosts:"tertiary.com secondary.com" package:"com.antonc.applinktest". 

03-25 17:54:46.762 1481-30947/com.google.android.gms I/IntentFilterIntentService: Verification 12 complete. Success:false. Failed hosts:tertiary.com,secondary.com. 

は、あなたが見ることができるように、それは私が明示的に設定されていても両方 secondary.comとtertiary.com、アンドロイドを確認しようとします。autoVerifyは=「false」をtertiary.com上のインテントフィルタのために!

これはAndroidのバグですか? IntentFilterIntentServiceが、android:autoVerify = "true"と設定したインテントフィルタのみを確認し、もう一方を外していることを確認するにはどうすればよいですか?

答えて

3

これはAndroidのバグですか?

動作が文書化されているように見えるので、私はこれを制限として説明します。 the documentationを引用:

ときアンドロイドは:autoVerify属性が存在している、あなたのアプリケーションをインストールすることは、ウェブのURI、アプリケーションのインテントフィルタの全てでに関連付けられているすべてのホストを検証しようとするシステムの原因となります。

(強調追加)

ことの私の解釈は自動ベリファイ場合の動作は、アプリケーションレベルでのオール・オア・ナッシングではないということです。私にはわかりませんなぜ彼らはそれをこう書いたのですか?それが長期計画であれば、私はautoVerify属性が<application>であると予想していたでしょう。

IntentFilterIntentServiceが、android:autoVerify = "true"と設定したインテントフィルタのみを確認し、もう一方を外しておく方法を教えてください。

別々のアプリに入れてください。

関連する問題