1

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

1
  • 2
    You may want to look into Content Providers since as far as I know that is the only way to access databases across different apps. The Notepad example comes with a Content Provider. Commented Apr 21, 2011 at 17:04

2 Answers 2

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

as a rule, I always use the same android:sharedUserId for all of my apps. make sure you DO NOT change the android:sharedUserId AFTER you have already published it. If I recall correctly, it wipes your databases and SharedPreferences.
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.