Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

test: Reply
 
LinkBack Thread Tools
Old November 17th, 2012, 10:19 PM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Nov 2012
Posts: 2
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 1 Time in 1 Post
Default Opening gmail attachment with my app

Hi!

I need to open files with custom extension using my app. I am able to do this using Intent filters when the file is in my sd card. I can also view the 'download' and 'preview' buttons if the file is sent as a Gmail attachment. However, when I clicked the download/preview buttons, I got the message - "Sorry, the attachment could not be downloaded".

I thought this was an issue with my app. But I had a random idea and installed "Download All Files" app on my phone.
https://play.google.com/store/apps/details?id=com.hwkrbbt.downloadall&hl=en
Then, when I click download button in Gmail, both Download All Files and My App are proposed for downloading the file. I chose my app, and everything works fine!!

Is this some security issue?
These are my Intent Filters:

[HIGH] <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="*/*" />
<data android:scheme="content" android:host="*"
androidathPattern=".*\\.ate" />
<data android:scheme="file" android:host="*"
androidathPattern=".*\\.ate" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/*" host="*" androidathPattern=".*.ate" android:scheme="content" />
</intent-filter>[/HIGH]

This issue is fairly urgent.. I would really appreciate it if someone has the solution or even just points me in the right direction! Thanks!

Advertisements
BeachBlue is offline  
Reply With Quote
sponsored links
Old November 18th, 2012, 10:00 AM   #2 (permalink)
New Member
Thread Author (OP)
 
Join Date: Nov 2012
Posts: 2
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 1 Time in 1 Post
Default

I figured it out myself, so I'm posting the solution, just in case someone else encounters this weird problem.

The intent filter requires both content and file scheme types, with the mimetype application/octetstream

[HIGH] <intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="file" androidathPattern=".*\\.inform" android:mimeType="application/octet-stream"/>
<data android:scheme="content" androidathPattern=".*\\.inform" android:mimeType="application/octet-stream"/>
</intent-filter>[/HIGH]
BeachBlue is offline  
Reply With Quote
The Following User Says Thank You to BeachBlue For This Useful Post:
jonbonazza (November 18th, 2012)
Reply
Tags
android, intents


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:21 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.