Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Intent filter does not show my app

I added this in my manifest to give the user the ability to open a xml file with my app. But when i click on a xml file and say "open with..." my app does not show up in the list! I also removed and installed the app new! The name of the file I test 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>
like image 882
XxGoliathusxX Avatar asked Jun 20 '16 23:06

XxGoliathusxX


People also ask

Can an activity have multiple intent filters?

However, since a component can have multiple intent filters, an intent that does not pass through one of a component's filters might make it through on another. An <intent-filter> element in the manifest file lists actions as <action> subelements. For example: <intent-filter . . . >

Is intent deprecated?

The Intent is not deprecated the problem is with your itemClickable. class because it is not recognized. Either you have somehow enabled extra warnings that identify Intent as deprecated or something is really stack at your machine.

How does intent filter work?

An intent filter is an expression in an app's manifest file that specifies the type of intents that the component would like to receive. For instance, by declaring an intent filter for an activity, you make it possible for other apps to directly start your activity with a certain kind of intent.

What is intent filter verification service app on Android?

An intent filter declares the capabilities of its parent component — what an activity or service can do and what types of broadcasts a receiver can handle. It opens the component to receiving intents of the advertised type, while filtering out those that are not meaningful for the component.


1 Answers

In this case, the right schema doesn't work, so delete your data tags and try this:

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

Let me know

like image 192
Erik Minarini Avatar answered Sep 19 '22 08:09

Erik Minarini