How has the intent filter changed from Android 2 to Android 4?

I have the following intent filter in my AndroidManifest.xml, which works fine in Android 2.xx and does nothing in Android 4.xx:

<intent-filter android:icon="@drawable/ic_fx_603p_pf" android:label="FX-603P Program File" android:priority="1" > <category android:name="android.intent.category.DEFAULT" ></category> <action android:name="android.intent.action.VIEW" ></action> <data android:host="*" android:pathPattern=".*\\.pf" android:scheme="file" ></data> </intent-filter> 

Question: what has changed and how can I make the intention again?

Expected behavior: when choosing a file with the *.pf in the file manager (for example, Astro), my application should be running and the file should be open. In addition, the file manager should use the provided icon to render the file.

+1
android android-intent android-manifest
Dec 18 '13 at 5:34 on
source share
1 answer

Well, after some experimentation, I found out that android:mimeType is optional. Therefore, the solution:

  <intent-filter android:icon="@drawable/ic_fx_602p_pf" android:label="FX-602P Program File" android:priority="1" > <category android:name="android.intent.category.DEFAULT" ></category> <action android:name="android.intent.action.VIEW" ></action> <data android:host="" android:mimeType="*/*" android:pathPattern=".*\\.pf" android:scheme="file" ></data> <data android:host="*" android:mimeType="application/x-fx-602p.program" ></data> </intent-filter> 

As additional information, I found out that <intent-filter> can have two or more <data> tags. If either a match, the name of the call (logical OR)

Inside the tag, all attributes must match (logical AND).

However, there is a problem with this solution: it seems that there is an error in Android 2.x, and the <data> attributes are not strictly processed logically. As a result, all files are mapped when the android:mimeType attribute is set. Ah, well, you cannot have it in both directions and will go with the future, if so.

0
Dec 18 '13 at 17:10
source share



All Articles