Filter junk files in android - android

How to find junk files in android. I don't want someone to code for me.
I just want to know how could i know whether a file is junk or not.
Or what are the criteria for checking a junk files. Or where must be
junk files stored .As in windows some files are stored in TEMPDATA and some data is stored in APPDATA. Where does android store these files.
And when can i delete these files. These can be shared by some
app.How could i know whether to delete it or not.
As this app does.

Due to the security mode in each Android app runs in its own sandbox. Temporary or junk files created by the app are stored in the apps own data folder located at:
storage/data/data/apppackagename
There may be any kind of file stored in this location including databases and preferences for the app.
This system allows android to remove the files easily when the app is uninstalled, or when the user goes to android settings for the app and selects clear data.
On non-rooted devices no other apps will have access to this folder.
It is possible for an app to write a file to the to external storage on the device. These files will persist after the app has been uninstalled, but you will have no way of knowing where the file has come from and if it is still needed.

Related

Is there a location to keep app files after app uninstallation in Android Q, except Media collections or Downloads

According to https://developer.android.com/preview/privacy/scoped-storage, an app with sandboxed view can just access files located in app-specific directory or Media collections or Downloads in Android Q.
I'm just confused if I want to keep app files after app being uninstalled where can I write my files, except Media or Downloads directory.
Writing files in inappropriate location is bad, so this question is just to find if it's possible when app works with scoped storage.
I want to keep app files after app being uninstalled where can I write my files
Use the Storage Access Framework (e.g., ACTION_CREATE_DOCUMENT or ACTION_OPEN_DOCUMENT_TREE). This will allow the user to choose where your app writes the user's data on the device, and most locations that the user might pick will remain around after your app is uninstalled.

Is the PathProvider documents directory a secure location?

Can anyone confirm that the documents directory file storage method with Flutter is secure or whether the AppData directory is where/how Android stores its Internal Storage files?
I'm looking at storing some persistent local data on the device but I want to make sure the data I write is not plain text or accessible by anyone/anything else. If this was a regular Android application, I'd be using Android's Internal Storage which says data stored is "private to your application and other applications cannot access them (nor can the user). When the user uninstalls your application, these files are removed."
Flutter has its own platform-agnostic way to read and write files and its documentation says saving things to its documents directory stores files "only it can access. The system clears the directory only when the app is deleted. On iOS, this corresponds to NSDocumentsDirectory. On Android, this is the AppData directory."
It looks like these are talking about the same thing and would therefore meet my security criteria, but these are things I'm not very familiar with and I don't want to take a risk with my users' data. I tried googling to find out what gets saved in the "AppData" directory on Android but mostly found people talking about their Android Studio installations.
Yes, NSDocumentDirectory on iOS and AppData on Android are secure locations.
This line from the example gives you the correct path for storing files which can only be accessed by your app:
String dir = (await PathProvider.getApplicationDocumentsDirectory()).path;
On Android dir resolves/data/data/com.yourcompany.AppName/. On iOS devices the folder is /var/mobile/Containers/Data/APP_ID/Documents.
Check the Android Security Tips , the section on Internal Storage:
By default, files that you create on internal storage are accessible
only to your app. Android implements this protection, and it's
sufficient for most applications.
The exception here is that when your app runs on a rooted Android device, the app data folder is not secure any more, see https://stackoverflow.com/a/8184699.

Only my application should have permission to access the files generated by app

My application generates some .csv files while running and these files are placed inside Android File system. These files are accessible outside the application also(as i can open these files in text editor and modify...)
Now I want that only my application should be able to read/write into these files.
Please help me in achieving this.
Thanks a lot.
These files are accessible outside the application also(as i can open these files in text editor and modify...)
Presumably that means you are placing them on external storage.
Now I want that only my application should be able to read/write into these files
Place the files on internal storage. This will prevent ordinary Android users from accessing the files except via your app.
Owners of rooted devices can get at those files, and if you are concerned about that scenario, then do not create any files at all, as owners of rooted devices can get to anything.
Also see article here: http://developer.android.com/training/basics/data-storage/files.html
It informs about internal vs external storage as well as making data public vs private for your app.

I want to password protect my local phone directory folder in android

I want to password protect my local phone directory folder
This folder (directory) has been created by my application at run time with password protection.
My application can open this folder and used for self.
Any one can't open this folder manually. It is possible in android.
Thanks in advance.
This is not possible on Android.
You could create your folder on the internal memory, so that only your app can access it on normal devices. However, anyone with a rooted device will be able to browse your folder using a file manager, and other apps will also be able to read its contents if given root access.
A folder on the external storage is accessible to all apps with the READ_EXTERNAL_STORAGE permission, so you'll want to avoid using that.
At any rate, there is no 100% effective way to secure your folder such that only your app can access it.
However, you could try encrypting your data. This is what many apps like whatsapp do. Even when Whatsapp backs up the chats to the external storage, it is AES encrypted so that while others can access the data, they can't read it without decrypting it first. I would recommend that your try encryption

where is my application folder in android?

My application records some data from a sensor of my phone, and it store the data to a file in the application's directory.
I run my application under the debug mode. And I was trying to find the application's folder and open the file with the saved data. However, I was not able to even find the app's folder.In the log information, it said the app's location is
" '/data/app/myAppPackage.apk' (success) ---"
but I can not find it anywhere by browsing the phone's disk.
Any hints?
thx in advance
From my understanding you will not be able to view this data on the mobile device. When you test the app in eclipse you will be able to see in the applications folder the new data sets, But on your phone, it is encapsulated by the APK.
Try saving the values to sd card?

Categories

Resources