Android file community

My manifest:

<intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="http" android:host="*" android:pathPattern=".*mht" /> <data android:scheme="https" android:host="*" android:pathPattern=".*mht" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:mimeType="message/rfc822" android:scheme="http" /> <data android:mimeType="multipart/related" android:scheme="http" /> <data android:mimeType="message/rfc822" android:scheme="https" /> <data android:mimeType="multipart/related" android:scheme="https" /> </intent-filter> 

Results:

Very curious, no? What am I doing wrong here? Just as weird - my manifest:

 <intent-filter android:icon='@drawable/ic_launcher' android:label='AndroidMHT File' android:priority='1'> <action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.EDIT" /> <action android:name="android.intent.action.PICK" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="file" /> <data android:scheme="content" /> <data android:mimeType="*/*" /> <data android:pathPattern=".*\\.mht" /> <data android:host="*" /> </intent-filter> 

Results:

  • /mnt/SDCARD/Android/data/com.mht/files/flipie.mht <--- chooser does not display my program as an option
  • /mnt/SDCARD/Android/data/com.mht/files/keepme.mht <--- chooser displays my program as an option

I'm at the tips. Any help was greatly appreciated.

+1
source share
3 answers

The suggestions in the first answer helped me: Android intent filter: associate the application with the file extension

This is my new manifesto for those who can benefit from it:

 <intent-filter android:icon='@drawable/ic_launcher' android:label='AndroidMHT File' android:priority='1'> <action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.EDIT" /> <action android:name="android.intent.action.PICK" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:mimeType="*/*" /> <data android:pathPattern="*.mht" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="http" android:host="*" android:pathPattern=".*\\.mht" /> <data android:scheme="https" android:host="*" android:pathPattern=".*\\.mht" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:mimeType="message/rfc822" android:scheme="http" /> <data android:mimeType="multipart/related" android:scheme="http" /> <data android:mimeType="message/rfc822" android:scheme="https" /> <data android:mimeType="multipart/related" android:scheme="https" /> </intent-filter> 
+6
source

When extracting files from your website, can you check what types of content are in the two files? I would expect a different behavior if they showed a different type (perhaps the web server interprets the data and sees different triggers in each file).

I checked the headers of http://web-sniffer.net/ and the second file no longer exists, so I can not compare.

Another wrinkle that can affect things is if you don't configure the user agent to match your Android devices, you can get a different result in your desktop browser or web sniffer.

Not sure if this is causing your problem, but worth checking out.

0
source

You can try changing the following attributes

 android:mimeType="text/*" android:pathPattern="*.mht" 

into your intent filter

0
source

Source: https://habr.com/ru/post/988267/


All Articles