How to Download an mp3 into hidden folder - java

I am trying to download an mp3 file from an API into my mobile, I want it to download in a hidden folder.
I tryied the folder name start with "." (eg .foldername). But this file that I can access fom file manager, It only hidding form gallery and other apps.
Next I tried to Encrypt the dowloaded file. The problem that I face is, if the download is stop in the midway due some network issue, at that time what all packets (mp3) is downloaed that can acces in file manger,its not encrypting.
That is if downloading is stop when it is 50% , then the 50% of that file is access form the file manager, its only encrypting when the downloading is completing.
Also during file downloaing I can access the file from File Manager.
Is there any solution to hide the downloading file from the File Manager

Related

Download an email attachment file to a custom folder in Android external storage

In my app I've created a parent folder in external storage with child folders inside named after the current user's userId.
How would I programmatically direct email file attachment downloads to one of these folders? Is there a way to add these folders to the Share Sheet?
I want to be able to open an email with an attachment in an email client app and download the attachment directly to one of these folders. The only way I can see how to do it now would download the file to downloads and then copy the file to my custom folder.
But, is there any way I can directly download the attachment file to my custom folder?

Why am I getting parsing error when opening APK file from app cache?

I'm trying to download an APK file online from within my app and then install it using Java. My code basically, downloads the file to the device from my server and then uses an Intent to open the installation message from the package manager and allow the app to be installed.
It works perfectly for me... unless I save the file to cache instead of regular storage. If I save it to cache instead, I get an error that it could not parse the APK file.
I checked and it is downloading the entire file to the cache correctly, but it just not installing. Any ideas?
The only difference in my code is that instead of using Environment.getExternalStorageDirectory() + "/file.apk" I'm trying to use context.getCacheDir() + "/file.apk" as for my file path.
I want to put the file in the cache so that Android can handle the cleaning of the file and so that I don't need to worry about handling write permissions on different Android versions and the variations of dealing with external storage.

How do I campare contents of local folder on android sdcard with the contents of a folder on dropbox?

I am developing a android app and I am supposed to download some data to a folder on sdcard from dropbox folder and once the download is complete only then the app can start.
The problem is I have some files available on my sdcard folder which are also present on dropbox folder along with some other files ,and now when I start my app I should be able to download only those files which are not there on my sdcard folder. How should I go by it? Thanks.
When you download any files from Dropbox, store the rev value from the Dropbox file's metadata.
Later, when you check again, if the remote rev matches your local value, you know you still have the same version. If not, download the new version.
Just checking the filename and file size is error prone, since two different versions of a file can have the same size.
Edit: The Dropbox API now offers a hash of file data that you can use to verify a file's contents. In the API v2 Java SDK, it's available as FileMetadata.contentHash.
It isn't a single MD5 or SHA1, but rather a combination of SHA256 hashes of the pieces of the file. You can find more information here:
https://www.dropbox.com/developers/reference/content-hash

How to download video from url and hide/secure this video from other apps and Gallery

One part of my current project is downloading Videos from URL then saving to SDCard. But the problem is all of saved videos in sdcard is displayed in android gallery page. What I want is "I don't want all of my saved vidoes in android gallery."
Create a .nomedia file inside the folder you don't want to be tracked by the MediaScanner. Maybe you'll need to rename the folder name after creating the file, since there is a bug that the MediaScanner (in some versions of android, not sure which one) fails to forget already-indexed files when it encounters a .nomedia file.

Accessing files stored in emulated storage

I currently have an application that downloads files from a server and by default they are stored under /storage/emulated/0/ . I set it up so they download to a folder called "data". The files successfully download and unzip to /storage/emulated/0/data/unzipped , however, when I try to load an html file, stored under the data folder, into a webview, I get an error saying the file can't be found. I double checked the file path of the html file using Astro File Manager and was able to verify I have the right file path. Here is the statement I use to load the html file into the webview.
wb.loadUrl(Environment.getExternalStorageDirectory()
+ "/data/unzipped/output.html");
I have tried it with and without the .html extension and still no luck. Any ideas? Are there are restrictions on accessing the emulated storage?
File paths are not URLs. Use the file:// scheme to access files.

Categories