Opening email attachments on Android

I am trying to open a specific type of email attachment using my activity, the application itself is an ini file with a plain text window with the extension * .os. In the email, this file is attached as "application / octet-stream". I tried the following intent filter to catch the application 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 application retrieves the attachment, but then tells me: "The attachment cannot be displayed." What can I do? How can I debug this?

+7
android
source share
2 answers

It should be just a file scheme, so I would eliminate the rest and try with this and include mimeType as a template (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 this does not work, perhaps try running the android.intent.action.MAIN command for the action. Check the logs to see if it gives details of an intent that doesn't match anything.

+1
source share

My solution that worked in .wav files was to install mimeType:

  <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="application/os" /> </intent-filter> 
0
source share

All Articles