android - DownloadManager addCompletedDownload() method not working, gives SecurityException -


i using url download , read bytes of data using inputstream, data fetched writing using fileoutputstream in form of pdf. using environment.getexternalstoragepublicdirectory(environment.directory_downloads).tostring();

to write file in downloads folder.

the file gets downloaded in download folder, , can access using filemanager, no issues in that. file not appear in downloads app. so, tried using downloadmanager object

mmanager = (downloadmanager) getsystemservice(context.download_service); 

and once download has happened, using

mmanager.addcompleteddownload(filename, "hello", true, "application/pdf", "nn",bufferlength,false); 

from sources

addcompleteddownload method

now, first query,

  1. i not quite being able understand must mention string path

  2. using line of code, getting securityexception says securityexception invalid value visibility 2 android

any highly appreciated.

securityexceptions usualy rised when dont provide needed permissions.also maybe helpfull : http://technofaq.org/posts/2014/04/fixing-external-sd-card-write-issue-on-android-kitkat/


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -