开发者

Access database of another app

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

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?

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


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

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.

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).


The standard way is to implement a ContentProvider. Use permissions to control access. http://developer.android.com/guide/topics/providers/content-provider-basics.html http://developer.android.com/reference/android/content/ContentProvider.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜