Reputation: 1594
I want do download file and store in application data directory
context.getPackageManager().getPackageInfo(context.getPackageName(), 0).applicationInfo.dataDir
// /data/data/<PackageName>/files
but after download complete this folder show empty
Download Manager call
dm = (DownloadManager) mContext.getSystemService(DOWNLOAD_SERVICE);
DownloadManager.Request request = new DownloadManager.Request ("video url");
request.setDestinationInExternalPublicDir("file path /data/data/<PackageName>/files","filename.mp4");
enqueue = dm.enqueue(request);
Upvotes: 0
Views: 605
Reputation: 75629
Download Manager is not running as part of your app - it's 3rd party application (separate process from technical viewpoint), therefore your data directory is NOT accessible to Download Manager same way as it is not accessible to any other 3rd party application. If you must download it directly there, you need to deal with downloading yourself. Alternatively you can download to location DM can write into and then move the file to your destination folder once it finished.
Upvotes: 2