mercredi 26 novembre 2014

SecurityException when using Android downloadmanager


Vote count:

0




I use this code for download a file:



lastdownload = mgr.enqueue(new DownloadManager.Request(uri)
.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI)
.setAllowedOverRoaming(false)
.setTitle(titledownload)
.setDescription(descriptiondownload)
.setDestinationUri(
Uri.fromFile(new File(dirdownload + "/OfflineMap/"
+ namedownloadedfile))));


Works fine, but ons some devices I get this error:


java.lang.SecurityException: Destination must be on external storage: file:///storage/sdcard1/OfflineMap/


It appears only with Sony Xperia devices... /storage/sdcard1/ is a valid path on Xperia devices... Does anybody know how to fix this?



asked 28 secs ago







SecurityException when using Android downloadmanager

1 commentaire: