I am downloading data from the server using the Try something like this: DownloadManager class in Android. I want to save data in internal memory (data / data / mypackage / file / ...) instead of external memory. How to do this?
DownloadManager dm = (DownloadManager) Download the application. Thes.getSystemService (Context.DOWNLOAD_SERVICE); DownloadManager.Request REQ = New DownloadManager.Request (URI.parse (MY_LINK)); Req.setTitle (MY_TITLE) .setDescription ("Downloading ...") // Download Package in / sdcard / Downlaod Path .setDestinationInExternalPublicDir (Environmental. DIRECTORY_DOWNLOADS, MY_PATH); Long enque = DM.exe (rake);
// If there is no SD card, then (environment .getExternalStorageState () == faucet) {directory = new file (environment .gate data directory ("+ / robotiumtastog /"); PhotoDirectory = New File (Environmental Gate Data Directory ("+ /" Robotium-Screenshots / "); // If no directory exists, create new directory (! Directory.exists ()) {directory.mkdir (); } // if the phone has an SD card, then the second;) if (environment. Gatesteenstoristestat (!) = Null) {// SD card directory = Search the directory on the new file (Environment Gatestinstoraz Directory () + "/ robotiumtstog / "); PhotoDirectory = New File (EnvironmentalGetInstyle Storey Directory ("+ / robotium-screenshot /"); // If no directory exists, create a new directory to store test //; (! Directory.exists ()) {directory.mkdir (); }}
Comments
Post a Comment