Football Fans: Download the 2012 Schedule App from Google Play!


Go Back   Android Forums > Android Development > Application Development > Developer 101

Developer 101 101 Tutorials



Reply
 
LinkBack Thread Tools
Old November 4th, 2011, 11:04 AM   #1 (permalink)
New Member
 
Join Date: Nov 2011
Posts: 1
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default Android browser gets stuck when downloading files

I have this very specific request that I need to implement. We are
working on an application that lets users attach several different
type of files (pdf, jpg, png, doc, txt, etc). I need to be able to
download the file using Android's default browser.
Here's the problem I have: the URL I get from the server is usually
like this: "https://serverort/notes/attachment/91" and if I do:

`Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url.toString()));
mContext.startActivity(i);`
Then, after the user authenticates the download seems to start but
gets stuck in 0% and fails. I read that there's a restriction and
Android's browser only downloads files the system recognizes, so I
tried setting the type but then I get an exception:

ERROR/AndroidRuntime(23344):
android.content.ActivityNotFoundException: No Activity found to handle
Intent { act=android.intent.action.VIEW dat=https://serverort/notes/
attachment/91 typ=image/png }

I'm not sure if this matters but the backend of this app is done in
Ruby on Rails and also I know the name and type of file prior trying
to download the file.

I've already implemented a method for the app to handle the file
download but the client wants to be completely sure there's no other
way.

One more thing, this app should support Android 2.1.

Is there a way I can download this file using Android's file?

arh26 is offline  
Reply With Quote
Sponsors
Reply

Bookmarks


Go Back   Android Forums > Android Development > Application Development > Developer 101 User CP
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 08:12 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo