android - Opening files downloaded by DownloadManager causes "The document path is not valid" error -
i'm trying open pdf file downloaded downloadmanager time time i'm getting "the document path not valid" on samsung galaxy s3 android 4.1.2
intent:
intent openintent = new intent(intent.action_view); openintent.setdataandtype(downloadmanager.geturifordownloadedfile(lastdownloadid), "application/pdf"); startactivity(openintent);
permissions:
<uses-permission android:name="android.permission.write_external_storage" />
downloadmanager:
environment.getexternalstoragepublicdirectory(environment.directory_downloads).mkdirs(); downloadmanager downloadmanager = (downloadmanager) getsystemservice(context.download_service); long lastdownloadid = downloadmanager.enqueue(new downloadmanager.request(uri) .setallowednetworktypes(downloadmanager.request.network_wifi | downloadmanager.request.network_mobile) .setallowedoverroaming(false) .settitle(title) .setdescription(description) .setdestinationinexternalpublicdir(environment.directory_downloads, "myfile.pdf"));
what doing wrong?
edit: time i'm getting this:
column_id: 108 column_bytes_downloaded_so_far: 33085 column_last_modified_timestamp: 1397152425941 column_local_uri: null column_status: 16 column_reason: 1008
why?
a status of 16 status_failed
, meaning download failed. reason of 1008 error_cannot_resume
, , have no idea means in real world. but, file not downloaded, , hence have no uri
.
Comments
Post a Comment