Preventing file copying on Android device when app is running

1.9k Views Asked by At

So I want to prevent people from copying files out of my app while it is running.

1) Is there an easier way to detect if files are being copied off my device than through checking if the adb daemon is running?

2) Is there an easy way to enumerate all processes running on the Android OS from an app?

I know Android is not a very secure system, but I would at least like to make it difficult for people to copy files off of my app.

EDIT

To clarify my problem, all the files I have stored on the disk are encrypted. My concern is that I need to unencrpyt these files when accessing them in my app. I am trying to prevent someone from stealing these files while the app is running. I already delete the unencrypted files if someone exits out of the app.

Also, I was focused on adb because I was considering trying to delete unencrypted files if connected by usb. However, I know you can still run adb over wifi on a rooted phone. Now that I think about it, you can probably transfer files over by wifi on a rooted phone as well.

Also, obviously not having the files on the device is not an option.

3

There are 3 best solutions below

0
On BEST ANSWER

You seem focused on adb, for unknown reasons.

With respect to internal storage, users cannot copy files off of internal storage of a device using adb, unless the device is rooted. And if the device is rooted, they do not need adb to copy files.

With respect to external storage, that is specifically designed to allow any app, or the user, to copy files from it, again without adb.

Hence, trying to detect adb is pointless.

I know Android is not a very secure system, but I would at least like to make it difficult for people to copy files off of my app.

Then don't put the files on the device in the first place.

1
On

I'm not sure what "copying files out of my app" means (is your app designed to show/provide files, or are you referring to the resources and other files used by your app).

In any case, you're wasting your time. Android is a very open platform and (particularly on rooted devices) people will always find a way to copy data if they want to.

3
On

I'm not sure if you mean that a user would use your application and put his phone on USB mode and proceed to transfer file off your application folder while your application is still running ?

If some files are needed in order for your application to function at runtime, can't your just make them private to your application ? Like illustrated in this article. Or simply don't put files on the device :)