Reputation: 976
I'm creating an app that has to appear on the Share menu, but I only want it to appear when the file that is being shared has a 'foo' extension (filename.foo). I have to add that I don't know what mime type the file is and that I'm a newbie on android.
This is the code inside the manifest:
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.foo" />
<data android:host="*" />
</intent-filter>
I got a waring on the "pathPattern" line, saying this:
App is not indexable by Google Search; consider adding at least one Activity with an ACTION-VIEW intent filter.
So I suppoused that the code actually works but with a VIEW action, not a SEND action.
Upvotes: 2
Views: 201
Reputation: 1006614
I only want it to appear when the file that is being shared has a 'foo' extension (filename.foo)
Files are not shared in Android. Content is shared. Content does not have a file extension — it has a MIME type. What you want is not supported by Android.
This is the code inside the manifest
ACTION_SEND
does not use a Uri
. All of your <data>
elements are invalid, except for <data android:mimeType="*/*" />
.
I got a waring on the "pathPattern" line, saying this
You had that same warning before you added this <intent-filter>
. You will get that same warning in a brand-new Android Studio project. It is unrelated to your <intent-filter>
and simply is annoying noise from the IDE.
Upvotes: 1