从另一个应用程序复制Android的数据库? [英] Duplicate Android database from another application?

查看:116
本文介绍了从另一个应用程序复制Android的数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个版本的同一应用程序。

当人们从免费版本升级到付费版本,我想免费的数据库复制到亲数据库的位置。

有没有一种方法,如果它属于另一个应用程序,我可以访问数据库文件本身?
与文件,甚至属于应用程序或者是它通常通过访问文件系统?

最后,我怎么的路径,数据库文件没有硬编码呢?

解决方案
  

有没有一种方法,我可以访问   数据库文件本身是否属于   另一个应用程序?

只有当这两个应用程序共享一个用户ID和由相同的签名密钥被签名。

  

与文件,甚至属于   应用程序或者是一般   通过文件系统访问?

这将是可通过文件系统(/data/data/your.package.goes.here/databases/whatever-you-called-the.db <$ C C $>),但同样,仅在这两个应用程序共享一个用户ID和由相同的签名密钥被签名。

  

最后,我怎么了路径   没有硬编码数据库文件?

您必须到C很难$ C $,或两者至少可变部分(包名和数据库名),你已经知道在编译时。

I have two versions of the same application.

When people upgrade from the free version to the paid version I'd like the free database to be copied to the pro database location.

Is there a way I can access the database file itself if it belongs to another application?
Does the file even belong to the application or is it generally accessible through the filesystem?

Finally, how do I get the path to the database file without hardcoding it?

解决方案

Is there a way I can access the database file itself if it belongs to another application?

Only if both applications share a user ID and are signed by the same signing key.

Does the file even belong to the application or is it generally accessible through the filesystem?

It would be available via the filesystem (/data/data/your.package.goes.here/databases/whatever-you-called-the.db), but again, only if both applications share a user ID and are signed by the same signing key.

Finally, how do I get the path to the database file without hardcoding it?

You have to hardcode it, or at least the variable components (package name and database name), both of which you already know at compile time.

这篇关于从另一个应用程序复制Android的数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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