java - Protect and unprotect file to avoid accidental elimination in Android by bugged cleaning apps -
in android app save files data file using
fileoutputstream savedlist = new fileoutputstream(path);
in folder named myapp located in sd storage
unfortunately have noticed cleaner apps, not implemented, popular (e.g. cleanmaster) wrongly remove files every time user perform temp\trash file cleaning causing problems.
is there way protect (and unprotect writing) file programmatically avoid this?
how change file permissions?
since aren't used file extensions recognize file format, how change metadata of file used determine file format these file see documents these apps? suppose scan of these cleaners use strategy based on linux file format recognition , remove object files.
android allows have private directory on sd card app. can path private directory app follows.
file mydir = getexternalfilesdir(null);
//the null parameter indicates going store type of files in directory
mydir.mkdirs();
log.d("info", mydir.getpath());
it same directory on sd card thing data store on folder private app , not available programs gallery. folder gets deleted when app deleted device.
checkout following link android docs. http://developer.android.com/reference/android/content/context.html#getexternalfilesdir(java.lang.string)
Comments
Post a Comment