2016-06-27 2 views
2

私の目標は、Androidで自動的にtest.touchwonders.comで始まるリンクを開くことです。私は自分のサーバー上で必要なファイルを配置します:https://test.touchwonders.com/.well-known/assetlinks.jsonAndroid:インテントフィルタの検証エラー

これは私のマニフェストの関連する部分である:

<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> 

アプリをインストールし、しかし、これは私が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. 

私のデバイスはチャールズプロキシを使用してリクエストを見ることができます。私はtest.touchwonders.com toughへの外出要求は見ません。私はadb shell pm clear com.android.statementserviceをインストールしました。これはキャッシュをクリアし、jsonの再フェッチを強制すべきです。

+0

このリンクを参照してください。http://stackoverflow.com/questions/37524073/can-i-broadcast-custom-intent-through-my-html-page-link-from-browser –

+0

インテントURLを使用することをお勧めします。いいと私はそれを正常に使用していますが、それはあなたがhtmlを変更することができる場所でのみ動作します。私は(彼らはGoogleの検索結果に表示されるので)定期的なhttpのURLを開くことができるようにしたいと思います。 –

+0

お手伝いできることが1つあります。 'intent-filter'の' data'セクションを修正する必要があります。データタグには、次のようなすべてのパラメータが含まれている必要があります: ''また、各スキーム、ホストなどに同じデータを追加する必要があります。[Android docs]の例を確認してください(https://developer.android.com/training/app-indexing/deep-linking.html#adding-filters) – comrade

答えて

0

私のアプリではなく、ウェブサイトのサーバー上のassetlinks.jsonファイルで問題が判明しました。私の場合、問題はサーバーの応答のMIMEタイプがapplication/jsonではないということでした。私の本当の問題は、私の資産リンクファイルをテストする方法がないことでした。私はその間に1を発見した:

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

を参照してくださいと

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

私はこのようなものを持っています、https://gist.github.com/chamnap/0613fe642ee5e74e1d28ead2cba2b45c。何かが間違っている? – Chamnap

+0

@Chamnapはい、assetlinks.jsonファイルの内容と "debugString"を含むフッターを取得する必要があります: "******************* ERRORS ** ****************** \ nいいえ! –

0

テストのURLを使用し、私は同じ問題を抱えていたし、問題がassetlinks.jsonファイルに関連していませんでした。私は3つの異なるドメインを持っていて、そのうちの1つが誤った設定に失敗していました。たとえ1つのドメインだけが故障していたとしても、applinkは他のドメインでも機能していませんでした。すべてのドメインが期待どおりに機能しているかどうかを確認したい場合があります。