将数据从免费应用程序数据库导入到付费应用程序数据库
我目前在市场上有一个免费的应用程序,我也想提供它的付费版本。安装付费版本后,我想从免费版本导入数据库和共享首选项,以便用户可以卸载它而不会丢失任何内容。
问题是这样的:在我的免费版本中,我没有设置 android:sharedUserId
。如果我添加一个,系统上应用程序的 ID 就会发生变化,我将无法再访问数据。两个应用程序将使用相同的证书进行签名。如何导入数据而不弄乱免费应用程序的权限?
I currently have a free application on the market and I'd like to offer a paid version of it as well. Once the paid version is installed, I want to import the db and shared preferences from the free version so users can uninstall it without losing anything.
The problem is this: in my free version, I don't have a android:sharedUserId
set. If I add one, the app's id on the system changes and I can't access the data anymore. Both apps will be signed using the same certificate. How can I import the data without messing up the permissions of the free app?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,没有简单的答案。
您可以在免费应用程序的未来版本中添加带有 AIDL 接口的
Service
或ContentProvider
,然后使用它将数据导入到付费应用程序中。根据数据,这可能需要一些自制的“许可”机制来确保只有您的付费应用程序才允许使用已发布的接口。Unfortunately, there's no easy answer.
You could add a
Service
with an AIDL interface or aContentProvider
in a future release of the free app, then use that to import the data into the paid app. Depending on the data, that might require some homebrew "licensing" mechanism to make sure only your paid app is allowed to use the published interfaces.