I try to open a specific email attachment type with my activity, the attachment itself is a plain text windows style ini file with the extension *.os. In the email this file is attached as "application/octet-stream". I tried the following intent-filter to catch the attachment with my activity:
<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=".*\\.os"/>
<data android:scheme="https" android:host="*" android:pathPattern=".*\\.os"/>
<data android:scheme="content" android:host="*" android:pathPattern=".*\\.os"/>
<data android:scheme="file" android:host="*" android:pathPattern=".*\\.os"/>
</intent-filter>
The Email app is fetching the attachment but is then telling me "The attachment cannot be displayed". What can I do? How can I debug this?
If you can't open email attachments that are in formats your device recognises then you can probably fix the problem by removing the email account and then adding it again. These steps apply broadly to Samsung Android devices. The steps for your specific device may vary very slightly from those below.
Unrecognized file format One of the most common reasons why you can't open an e-mail attachment is because your computer doesn't have the necessary program installed to recognize the file format.
1: Adobe Reader. In my opinion, Adobe Reader (Figure A) is the single most important app for opening email attachments. The vast majority of the important attachments I receive are in PDF format.
It should simply be a file scheme, so I would eliminate the others and try with just that and include the mimeType as a wildcard (either "*" or "*/*"):
<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="file" />
<data android:mimeType="*" />
<data android:pathPattern=".*\\.os" />
<data android:host="*" />
</intent-filter>
If that doesn't work, maybe try android.intent.action.MAIN for the action. Check the logs to see if that's giving you the details of the intent that is not matching anything.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With