简体   繁体   English

保护我的应用程序文件(Android Studio)

[英]Protecting my app files(Android Studio)

Well hello, im working on a app that take a picture and then save it into the external storage, the problem that i get is when i use a external app, to clean up the cell phone memory, this kind of apps get into the folder where the pictures located, then deleted everything on it, i realy don't have any idea to protect them. 恩,您好,即时通讯正在处理拍摄照片的应用程序,然后将其保存到外部存储中,我遇到的问题是当我使用外部应用程序清理手机内存时,此类应用程序进入了文件夹图片所在的位置,然后删除了其中的所有内容,我真的不知道要保护它们。

sorry for the problems with my English is not my native tongue 对不起我的英语不是我的母语

I think the problem is not yours. 我认为问题不在于您。 The problem is your cleaner's. 问题是您的清洁工。 Modify the cleaner's settings. 修改清洁器的设置。 Android cleaner like Clean Master is just weird. Clean Master这样的Android清洁器很奇怪。 I don't know what kind of cleaning they do! 我不知道他们会做哪种清洁! Once they deleted my 150+ apps from my SD Card. 一旦他们从我的SD卡中删除了我的150多个应用程序。 So, if you are tensed about protecting your files from being deleted then it is worthless. 因此,如果您想保护自己的文件不被删除,那将毫无用处。 You can't. 你不能 Ok, think, a user is not using any cleaner to keep his/her phone tidy. 好的,想想,用户没有使用任何清洁剂来保持手机整洁。 But what will you do or how you will protect your files when the user is going to delete those files himself/herself? 但是,当用户自己删除这些文件时,您将怎么做或如何保护文件? The one thing you can do is - by achieving SuperUser permission from a user, you can just modify the SD Card's W/O or R/O system. 您可以做的一件事-通过获得用户的SuperUser权限,您可以只修改SD卡的W / O或R / O系统。 But it has also some disadvantages. 但这也有一些缺点。 If you do something lile this, then you app may be introduced as a malicious program by your user. 如果您这样做,那么您的应用可能会被用户引入为恶意程序。 So, afterall, the answer is it isn't possible... 所以,毕竟,答案是不可能的...

您应该使用:getFilesDir()此文件夹位于Android / data / data / your_package /中,因此除您自己的应用程序外,其他应用程序都不能访问它(除非具有root权限)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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