Android Question Manifest's intent-filter for MimeType "text/*"

peacemaker

Well-Known Member
Licensed User
HI, All

I'd like to receive by the app files of some kinds:
B4X:
AddActivityText(Main,
<intent-filter>
   <action android:name="android.intent.action.SEND" />
   <category android:name="android.intent.category.DEFAULT" />
   <data android:mimeType="image/*" />
   <data android:mimeType="text/*" />
   <data android:mimeType="application/pdf" />
   <data android:mimeType="application/msword" />
   <data android:mimeType="application/vnd.openxmlformats-officedocument.wordprocessingml.document" />
   <data android:mimeType="application/vnd.ms-excel" />
   <data android:mimeType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
</intent-filter>)
PDF, MS Office, images are almost OK (some *.doc? and *.xls? not always can be opened by MS Office, but always opened by other viewers\printers).

But no .txt files are filtered (to be captured). What's wrong ?
 

peacemaker

Well-Known Member
Licensed User
Maybe it's only on my Samsung A7 (Android 8) such trouble ?

Extra filter like this does not help also:
B4X:
AddActivityText(Main,
<intent-filter>
    <action android:name="android.intent.action.SEND" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:pathPattern=".*\\.txt" />
   <data android:mimeType="text/plain" />
</intent-filter>)
I unpacked Viber APK, it has such filter:
B4X:
            <intent-filter>
                <action android:name="android.intent.action.SEND"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <data android:mimeType="image/*"/>
                <data android:mimeType="video/*"/>
                <data android:mimeType="text/plain"/>
                <data android:mimeType="text/*"/>
                <data android:mimeType="*/*"/>
            </intent-filter>
But i do not need all files "*/*". And if i set such mime types - "No app installed for opening" a .txt file i try.

Attached the test project to check - start and try to share a .txt file from any app to this test app.
 

Attachments

peacemaker

Well-Known Member
Licensed User
I have found suddently that .txt files i choose to be shared has MIME type as "application/txt" !
Intent filter how is OK, but...
B4X:
AddActivityText(Main,
<intent-filter>
   <action android:name="android.intent.action.SEND" />
   <category android:name="android.intent.category.DEFAULT" />
   <data android:mimeType="image/*" />
   <data android:mimeType="application/txt" />
   <data android:mimeType="application/pdf" />
   <data android:mimeType="application/msword" />
   <data android:mimeType="application/vnd.openxmlformats-officedocument.wordprocessingml.document" />
   <data android:mimeType="application/vnd.ms-excel" />
   <data android:mimeType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
</intent-filter>)
... but there are no one app working with such MIME-type, so ACTION_VIEW is impossible.
Replacing "application/txt" to "text/plain" partially helps, but not fully...
 
Top