Android Intent filter does not show my application

I added this to my manifest to give the user the opportunity to open the xml file with my application. But when I click on the xml file and say "open with ...", my application does not appear in the list! I also uninstalled and installed a new application! The name of the file I'm testing with is Test.xml

<activity android:name=".activities.MainActivity" android:label="mainAcitivity" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="file" android:host="*" android:pathPattern=".*\\.xml" android:mimeType="*/*" /> </intent-filter> </activity> 
+5
source share
2 answers

In this case, the correct scheme does not work, so remove the data tags and try the following:

 <data android:mimeType="text/xml"/> <data android:scheme="content" android:mimeType="text/*" android:pathPattern=".*\\.xml"/> <data android:scheme="file" android:mimeType="text/*" android:pathPattern=".*\\.xml"/> <data android:scheme="http" android:mimeType="text/*" android:pathPattern=".*\\.xml"/> <data android:scheme="https" android:mimeType="text/*" android:pathPattern=".*\\.xml"/> 

Tell me

+3
source

Get the intention and analyze the data!

+2
source

All Articles