2017-01-20 9 views
2

インテルXDKを使用してCordova Phonegapアプリを開発し、AndroidManifest.xmlファイルを変更してexample.comへのhttpとhttpsトラフィックをキャプチャするインテントフィルタを組み込み、それを私のアプリにリダイレクトします。Androidアソシエーションのインテントフィルタの問題

私のインテントフィルタを更新していましたが、古いフィルタがAndroid 6.0.1で正常に動作していないことに気付きました。

古いバージョンのAndroid 5.xでは動作していました。

<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="http" 
      android:host="example.com" 
      android:pathPrefix="" /> 
    <data 
      android:scheme="http" 
      android:host="www.example.com" 
      android:pathPrefix="" /> 
    <data 
      android:scheme="https" 
      android:host="example.com" 
      android:pathPrefix="" /> 
    <data 
      android:scheme="https" 
      android:host="www.example.com" 
      android:pathPrefix="" /> 
http://example.comは」私はもはやアプリでそのURLを関連付けるように求めています訪問していない、しかし、 https://example.comは協会を求める、とんその関連付けは、その後、HTTPとHTTPSの両方のトラフィックを発生した後、アプリに送られます。

問題は、httpを使用するとプロンプトが表示されないことです。

私が試した2つのフィルタのバリエーションは、同じ問題(これには更新された機能が含まれています)です。

<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="http" android:host="*example.com" path="" /> 
     <data android:scheme="http" android:host="*example.com" path="/" /> 
     <data android:scheme="http" android:host="*example.com" path="/app" /> 
     <data android:scheme="https" android:host="*example.com" path="" /> 
     <data android:scheme="https" android:host="*example.com" path="/" /> 
     <data android:scheme="https" android:host="*example.com" path="/app" /> 
</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="http" android:host="*example.com" path="" /> 
    <data android:scheme="http" android:host="*example.com" path="/" /> 
    <data android:scheme="http" android:host="*example.com" path="/app" /> 
</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="https" android:host="*example.com" path="" /> 
    <data android:scheme="https" android:host="*example.com" path="/" /> 
    <data android:scheme="https" android:host="*example.com" path="/app" /> 
</intent-filter> 

これらの両方に同じ問題を持っています。

答えて

0

いくつかの読書を行った後:私は別の形式を使用してみました、と

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

https://developer.android.com/reference/android/os/PatternMatcher.html

https://developer.android.com/guide/components/intents-filters.html

このフィルタは、問題を解決しました。

<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="http" 
      android:scheme="https" 
      android:host="*example.com" 
      android:path="" 
      android:path="/" 
      android:pathPrefix="/app" 
     /> 
</intent-filter> 

これまでのフィルタが機能しなかった理由はわかりませんが、Androidのバグのようです。

誰かが興味があれば、私はこのインテントフィルターのための簡単なコードバー・プラグインも書きました。

https://github.com/KeithTurkowski/cordova-plugin-simple-android-url-intent-filter

+0

こんにちは!私も同様の問題があります。 では、属性が重複していることがわかります。それはあなたのためにコンパイルしましたか?私の場合は、スキームとパスが重複しているため、エラーとなります。 – RominaV

+0

インテルXDKを使ってビルドしても問題ありません。そして、それは期待通りに実行され、使用しているビルドプロセスを更新する必要があります。 –

+0

お返事ありがとうございます! – RominaV

関連する問題