2017-01-20 3 views
2

Ich entwickle eine Cordova Phonegap App mit dem Intel XDK, und die Änderung der AndroidManifest.xml-Datei mit einem Intent-Filter, der http und https Datenverkehr zu example.com erfasst und leitet es zu meiner App um.Android 6.x Intent Filter Probleme mit App Association

Ich habe meinen Intent-Filter aktualisiert, und mir ist aufgefallen, dass der alte Filter in Android 6.0.1 nicht ordnungsgemäß funktionierte.

Es hatte in älteren Versionen von Android 5.x funktioniert.

<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="" /> 

Bei einem Besuch in „http://example.com“ Ich bin nicht mehr aufgefordert, dass die URL mit der App zu verknüpfen, jedoch nicht https://example.com für den Verein fragen, und wenn diese Vereinigung geschieht, dann HTTP und HTTPS-Datenverkehr sind auf die App gerichtet.

Das Problem ist, dass die Eingabeaufforderung nicht angezeigt wird, wenn ich http verwende.

Hier sind zwei Variationen von Filtern, die ich ausprobiert habe, mit dem gleichen Problem (diese beinhalten meine aktualisierte Funktionalität).

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

Und ...

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

Diese beiden das gleiche Problem haben.

Antwort

0

Nach etwas zu lesen tun:

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

Ich habe versucht, ein anderes Format verwenden, und dieser Filter das Problem gelöst.

Es ist mir nicht klar, warum die vorherigen Filter nicht funktioniert haben, scheint es wie ein Fehler in Android.

Ich habe auch ein einfaches Cordova Plugin für diesen Intent-Filter geschrieben, falls jemand interessiert ist.

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

+0

Hallo! Ich habe ein ähnliches Problem. In der sehe ich, dass Sie Attribute dupliziert haben. Hat das für dich kompiliert? In meinem Fall ist es ein Fehler, weil Schema und Pfad dupliziert sind. – RominaV

+0

Funktioniert gut für mich, Gebäude mit dem Intel XDK. Und es funktioniert wie erwartet, Sie müssen möglicherweise den von Ihnen verwendeten Build-Prozess aktualisieren. –

+0

Danke für die Antwort! – RominaV