另一个应用程序访问数据库 [英] Access database of another app

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

问题描述

在开发网站,它说,如果你的应用程序都使用相同的证书,您可以共享数据签名。

On the dev site, it says if your applications are signed with the same certificate you can share data.

我想创建,我可以用一个CSV文件包,签署和打包的apk,当我在我的设备上运行它,我想为CSV导入到另外一个我的应用程序数据库的工具。这可能吗?

I would like to create a utility that I can pack with a csv file, sign and package the apk and when I run it on my device, I would like for that csv to be imported into another one of my apps database. Is it possible?

我知道如何让CSV到数据库但不知道如何把它变成一个不同的应用程序的数据库...

I know how to get the csv into a database but not how to get it into a different apps database...

推荐答案

您可以把您的数据库外部SD卡。没有安全那里。

You could put your database on the external sdcard. There is no security there.

有关保护共享文件的应用程序必须使用相同的证书签署,并有相应的机器人:sharedUserId在他们的Andr​​oidManifest.xml文件

For sharing protected files the applications must be signed with the same cert and have matching android:sharedUserId in their AndroidManifest.xml files.

您实用的应用程序可以尝试使用绝对路径打开其他应用程序的数据库。我不知道将与事务管理发生什么,如果这两个应用程序正在修改该数据库在同一时间。

Your utility app could try opening the other apps database with an absolute pathname. I'm not sure what would happen with transaction management if both apps are modifying the db at the same time.

一个更好的设计是只有自己和访问数据库中的一个应用程序。实现对拥有该数据库的应用程序的进口的意图处理程序。您的实用应用程序可以发送一个Intent,指定CSV文件名中的意图而额外。或者您也可以穿上意向的而额外的数据(如果是大的,然后发送一个Intent每个记录)。

A better design is to have one application only own and access the database. Implement an "IMPORT" intent handler on the app that owns the database. Your utility application can send an Intent, specifying the csv filename in the intent extraData. Or you could just put the data on the Intent's extraData (if it's large then send an Intent for each record).

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

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