简体   繁体   中英

Protect my Android app's files from “cleaners” and “optimizer” apps?

A rare but reoccurring problem reported with one of my apps is that "all my files were deleted" (files referring to project files generated from said app, save files essentially).

The culprit ends up being those "optimizer" apps that clean "unwanted" files from your Android device. Because my app generates custom-file-extension files, maybe they're not recognized and deleted?

Regardless, I know of the .nomedia file, a file used to tell media players to ignore a directory when scanning for media. Is there a similar file to "protect" directories from automated modification/deletion? Maybe even something placed in the Android Manifest?

Save the files in the internal storage that your app is assigned to by the system. No other apps can access it as it is private to your app. If you save files in a public directory, any app can access that.

File dir = context.getFilesDir()

To get your app's storage 'partition'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM