简体   繁体   English

某些手机​​删除SQLite DB

[英]Certain Phones delete SQLite DB

I've got an app created with Android Studio. 我有一个使用Android Studio创建的应用。

I'm using an SQLite database which gets downloaded and saved in phone's storage. 我正在使用一个SQLite数据库,该数据库已下载并保存在手机的存储器中。 The problem is that in certain types of phones (Lenovo / Xiaomi to be exact) the sqlite file gets deleted after some time and the users have to re-download it. 问题是在某些类型的电话(确切地说是联想/小米)中,sqlite文件会在一段时间后被删除,用户必须重新下载它。

The problem is appearing only on these 2 types of phones and also not all of them. 该问题仅出现在这两种类型的电话上,而不是全部出现。 I can't replicate that on any of the phones I tried nor emulated ones within Android Studio. 我无法在Android Studio中尝试或模拟的任何电话上复制它。 There is no code that would delete the SQLite file and also I couldn't find anything in here or google about Lenovo/Xiaomi having similar problems like mine. 没有代码可以删除SQLite文件,而且在这里或Google中我找不到关于Lenovo / Xiaomi的类似我的类似问题的任何信息。

Any Ideas, would be appreciated. 任何想法,将不胜感激。

I don't know about Lenovo, but Xiaomi phones have a "Clean up" feature that regularly (at least once a week, in my experience) asks the user to, well, let it clean up files. 我不了解联想,但小米手机具有“清理”功能,该功能会定期(以我的经验至少每周一次)要求用户清理文件。 I don't know what it uses to decide if a file is obsolete or not, but it is a very aggressive cleaner (it wants to clean up cache files for apps that have just been used and are in constant use, for example). 我不知道它是用来决定文件是否过时的,但是它是一种非常激进的清理程序(例如,它想为刚刚使用过且经常使用的应用程序清除缓存文件)。 This is likely what is removing your downloaded files. 这可能是删除您下载的文件的原因。 You can check the location you're downloading them to, and see if changing that helps; 您可以检查将它们下载到的位置,并查看更改是否有帮助; or you could see if you can find any documentation on the file cleaner so you can find out how to stop it from flagging your DB as "rubbish". 或者您可以查看是否可以在文件清理器上找到任何文档,以便了解如何阻止它将数据库标记为“垃圾”。

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

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