Swift
Swift

Reputation: 897

How to access one App's Database to another Application using Sqlite?

I have two applications which resulting to use database.

Application A which creates database name DB1. This database I wanted to access in application B. The applications are in different packages.

How can I do this ?

Upvotes: 1

Views: 2548

Answers (2)

Sunny
Sunny

Reputation: 1441

you need to have both applications installed using same user id. Add this to both manifests:

android:sharedUserId="com.abc.xyz"

Upvotes: 1

XeNoN
XeNoN

Reputation: 696

Application are not allowed to read private data of another application (you can do this only on rooted devices). The easiest way is to store database in some public location, but that is not recommend because any app on device will have access to database file...

Here is what you can do. You can create BroadcastReceiver-s from both sides and implement your communication protocol using message passing. Application B will broadcast requests, application A will handle that request and send result back to the application B. The only problem is that application A code must be updated to. For more info on how to use message passing, check this article

Upvotes: 2

Related Questions