更新应用程序-Android [英] Update Application -Android

查看:111
本文介绍了更新应用程序-Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个Android应用程序。
我的应用程序包含了本地数据库,位于应用程序的/资产产生的文件夹。
当用户安装该应用程序,它会将以数据库中使用它。然后,用户可以将项目添加到它。

I'm working on an Android application. My app contains a local database, located in the /assests folder of the app. When the user installs the app, it copies the database in order to use it. Then the user can add items to it.

我的问题是,如果我会发布的更新我的应用程序,将它清除数据(删除复制的数据库),从而消除用户对数据库的修改(因为应用程序将复制数据库中的资产再次文件夹) ?

My question is if I will release an update for my app, will it clear the data(deleting the copied database), thus erasing the user's changes to the database(Because the app will copy the database from the assets folder again)?

推荐答案

没有。如果用户更新应用程序(不卸载它 - 在这种情况下将被删除)和数据库已经存在,那么Android将不只是删除它(它可能包含重要信息!)

No. If a user is updating an application (not uninstalling it - in that case it will be deleted) and a database already exists then Android will not just delete it (it could contain important information!).

您SQLiteOpenHelper而不是 onUpgrade 方法将被调用,它是由你来决定,如果你要清除的数据或preserve它。

Instead the onUpgrade method of your SQLiteOpenHelper will be called, and it is up to you to decide if you want to clear the data or preserve it.

这篇关于更新应用程序-Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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