Search code examples
androidmime-typesintentfilterblacklist

How to make a kind of blacklist for some mime-types for Android application?


In our Android app we need to catch an ACTION_SEND intent from third-party apps with arbitrary mime-type

<intent-filter>
    <action android:name="android.intent.action.SEND"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <data android:mimeType="*/*"/>
</intent-filter>

except of .apk files, i.e. we need blacklist for .apk extension. Is it possible? It seems the answer is "No way", but I have two apps installed on my device, which definitely solve this problem. They are called for file with arbitrary extension lumix.p&z opened from DropBox app

and are not called with .apk oi.filemanager.apk. How does it possible?


Solution

  • It seems the answer is "No way"

    There is no way to specify a blacklist in the manifest.

    I have two apps installed on my device, which definitely solve this problem

    Dropbox is using a MIME type on the lumix.p&z request that those office apps have registered for. Dropbox is using a MIME type on the oi.filemanager.apk request that those office apps have not registered for. No blacklist is required. What is required is for Dropbox to have its own algorithms, possibly implemented on its servers, to guess an appropriate MIME type.