卸载并重新安装后,Android 应用程序会记住其数据 [英] An Android app remembers its data after uninstall and reinstall

查看:56
本文介绍了卸载并重新安装后,Android 应用程序会记住其数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开发针对 4.1 以上所有版本的 Android 应用程序时,我发现卸载我的应用程序并重新安装它不会清除其数据.

While developing an Android app targeting all versions above 4.1, I observed that uninstalling my app and installing it again does not clear its data.

该应用旨在存储它在第一个屏幕中询问的详细信息.4.4.4版本的OS卸载重新安装后,app提示用户填写数据,属于正常现象.然而,在 6.0 版中,相同的安装/卸载顺序会带回最初输入的数据.

The app is designed to store the details that it asks in its first screen. After uninstalling and installing again in OS version 4.4.4, the app prompts the user to fill in the data, which is normal. However in version 6.0 the same install/uninstall sequence bring backs the data originally input.

我试图通过访问 /data/data/my package folder 来确保卸载后数据库消失了,并且确实在卸载过程中删除了该文件夹.

I tried to ensure by visiting /data/data/my package folder to see the database is gone after uninstalling and indeed that folder gets deleted during uninstall.

我尝试通过访问设置页面,通过 Titanium Backup 删除该应用程序,结果是相同的.设备根植于运行 v6.0 的 Nexus 5.

I tried to delete the app by visiting the settings page, through Titanium Backup and the results are same. The device is rooted Nexus 5 running v6.0.

这种奇怪行为的原因是什么?

What could be the reason for this strange behavior?

推荐答案

这是因为 Android 6 有自动备份.如果您不想备份数据,则需要在清单 标签中调整 android:allowBackupandroid:fullBackupContent或者如果您想包括或排除某些资源.这不是错误.

It's because Android 6 has automatic backup. You need to tune android:allowBackup and android:fullBackupContent in your manifest <application> tag if you don't want your data backed up or if you want to include or exclude some resources. It's not a bug.

有关 Android 上 AutoBackup 的更多信息此处.

More about AutoBackup on Android here.

这篇关于卸载并重新安装后,Android 应用程序会记住其数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆