making an android app to hide files using java - android

I am making an android application. I would like to know as to how to make a program to hide files from the android phone.Like the "Hide it pro" application

I think there are three options:
Move the file in a directory which is not visible to other apps.
Encrypt the files and let them public (that means accessable for other apps)
Add into your directory where the files are inside a .nomedia file. But note that this just hide the files from the MediaScanner. But it will be simple accessable for other apps if they look into your directory.
By the way your operating system does not matter in any way. Just the target platform counts.

"Hiding your files from the Media Scanner
Include an empty file named .nomedia in your external files directory
(note the dot prefix in the filename). This will prevent Android's
media scanner from reading your media files and including them in apps
like Gallery or Music."
http://developer.android.com/guide/topics/data/data-storage.html
This won't hide files from the OS (or "the android phone") but it will prevent MediaScanner from picking them up and displaying them in built in apps. NOTE: In Android 4.0 there was an issue where existing indexed files were/are not forgotten if a NEW .nomedia file is created. To work around this create a new directory, add the .nomedia file, and move content you want to hide there.

Related

How to know where to look for media directories on android phone?

I am working on a Gallery app which requires knowing where to look within the user's android device for images/videos. Currently, I am brute forcing it by going all the way up to the root directory, looking specifically for directories starting with "storage" and "sdcard" and searching each and every sub folder for files containing the proper extension.
There must be a better way to find media directories within the Android file system, no? Can anyone suggest any alternatives?
Thanks!
Not sure if there is a way to find all media directories, you'll have to scan each folder.
But you can skip folders which has .nomedia file, This will save some scanning time.

Downloadable files in my application

I created a project which uses Fragments, and in one of them I want to add some clickable icons that will allow to download a file (one per icon).
I have the files stored on my computer.
I suppose that they have to be copied into my application.
How I can implement this in the code?
I hope that this picture can explain what I want to do.
will allow to download a file and they have to be copied into my application don't match: If the files are already on the device (once your app is installed), what is the sense of downloading those files again?
Therefore, either provide your files inside your app or use a file server and download them.
If you decide to provide the files in your app, this will increase the installation time.
But it would not require an internet connection to download the files again.
So, simply put your files in the raw or in the assets folder and that's all.
Then simply access your files from that folder.
If the folder isn't already found in your project, simply create it and drop your files in it.

Android app consisting of Sound Effects - how to copy files?

I wanted to create an app that consists mostly of sound effects - imagine a theme of sound effects.
The UI of the app would reflect the general theme and consist of buttons like "Copy sounds to device" and "Delete copied sounds from device"
Once the app has copied the sounds to the device, I would like to make the MediaScanner aware of the new files.
Problem: With the limits on the SDcard, how is it possible for a non-system app to copy the files to the sdcard or even delete them ?
Whilst working on this feature, I discovered :
1)getExternalStorageDirectory() is useless on new versions of Android
2) the Media Scanner is unable to access the folder supplied by getExternalFilesDir()
Solution
Copy files to a public folder obtained with getExternalStoragePublicDirectory()
https://developer.android.com/reference/android/os/Environment.html#getExternalStoragePublicDirectory(java.lang.String)

android making folder and all its subdirectory undeletable

i want to make and folder and all directory undeletable by user:
basically my app has large files and i want to play it from external sd card now problem is that most user delets them by mistake how can i prevent it
i also tried hiding foler by giving prefix . but its now working i name file .myfile but still i am able to view this file any idea ???..
Rather than populating a folder on the user's device, you could use an expansion file. http://developer.android.com/google/play/expansion-files.html

Save files locally, but prevent them from showing up in the users file manager

Using PhoneGap 3.2 and the File API, I'm downloading a set of images to display in the app. I create a folder named "Appname" and put all the files there. On Android this folder is accessible through the file manager, and on some models the images show up in the users image gallery.
Is it possible to save files locally, but prevent them from showing up to the user outside of the app?
Technically, no. Especially if the client has root access.
You may try the followings to mitigate the problem:
a) Name your files to start with a DOT (.) so that it is recognized as hidden file. (Still, a file manager configured to show hidden files can show it).
b) Store the file instead on some databases in the /data/data/your.app.packages path, which is by default only accessible to your app. (Still a root user can see it).
c) A linux trick. Create a file, open it, hold the file descriptor but remove the file. In this way the file is removed from the directory structure so that it doesn't show up in the FS layer (and thus inaccessible). To make it permanent, use the file descriptor you hold to create a link (or dig into the /proc directory tree to make links with files under fd.
Since this trick works on linux, I guess it should work on Android. But it's probably overkill.
d) Other stopgaps include encryption, obfuscation, etc. But they don't exactly fall into the kind you are looking for.

Categories

Resources