Lucifer
Lucifer

Reputation: 29632

How to Share Sqlite Between Two Application?

I have one Sqlite Database file. I want to share my sqlite database between two different android application. Is possible to do such ? if so the what necessary steps I should try ?

Upvotes: 1

Views: 8055

Answers (4)

Lalit Poptani
Lalit Poptani

Reputation: 67286

You need to create a custom Content Provider and use it in the other Application. Here is a complete example of how to create a Custom Content Provider and use it in another Application.

Upvotes: 0

Shitesh
Shitesh

Reputation: 1121

I haven't tried this out yet, but there's a way to share databases discussed over here: Share SQLite database between 2 android apps?

Upvotes: 1

Siddharth Lele
Siddharth Lele

Reputation: 27748

The short answer: Yes.

The long answer: You will have to "register" your application to share its contents with your second application. That being said, the down side is, you will be sharing your contents with every other application too. Not that I see it being a problem since other developers will not necessarily know how to gain access to your app's data using the Content Providers.

You can follow this link to read up about creating and access content providers.

Oh. Almost forgot. This is how you share data between applications. I have personally never heard of anyone having shared databases. DB's are always private to their own application and never exposed to others including the users. See this link for more about Databases in Android

Upvotes: 2

josephus
josephus

Reputation: 8304

You just need to know the uri of the table you want to access.

Upvotes: 0

Related Questions