I'm downloading a file using the DownloadManager.  I'm receiving the
ACTION_DOWNLOAD_COMPLETE broadcast but I'm having trouble opening the
file.  I'm creating a ACTION_VIEW intent with the data set to the Uri
I get from the getUriFromDownloadedFile method and the type set to the
String I get from the getMimeTypeFromDownloadedFile method.  I'm able
to start the activity to open the file, but the app is not able to
open it.  I know the file is being downloaded correctly because I can
go to my list of downloads and open it from there.  Any idea of what
I'm doing wrong?  Here is the code in my BroadcastListener:

long id =
intent.getExtras().getLong(DownloadManager.EXTRA_DOWNLOAD_ID);
DownloadManager dm =
(DownloadManager)getSystemService(DOWNLOAD_SERVICE);

intent = new Intent(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.setDataAndType(dm.getUriForDownloadedFile(id),
dm.getMimeTypeForDownloadedFile(id));
startActivity(intent);

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to