j2emanue
j2emanue

Reputation: 62549

Google firebase - how to share database with other apps

I know that, firebase there is a real time database and I have made use of it. But its based on authentication from the user first. What I would like to do is have the firebase realtime database share its content with other apps. Just like a ContentProvider in Android.

When I call :

FirebaseDatabase database = FirebaseDatabase.getInstance();

This is going to get the firebaseDatabase only for my app. I want other apps to be able to use the real time database as well. How can they connect to it?

UPDATE:
Conceptually can a contentProvider solve this issue? since a contentProvider is just an abstraction and it does not care what the datasource is, instead of using sql as the source i could use firebase db. Then since the firebase db is wrapped inside a contentProvider i could then expose a URI for other apps to use and make the contentProvider public. I'll have to look more into this but should be possible since contentProvider is a wrapper for a data sources either network or local. The ContentProvider.query command would return a cursor though, not sure how to make a cursor out of the retrieved firebase data.

Upvotes: 4

Views: 508

Answers (1)

Ognian Gloushkov
Ognian Gloushkov

Reputation: 2659

Option 1 would be to implement a custom backend serving as an access point to the data via some authentication.

Option 2 would be to make all the data you want to share publicly available and get a reference to that database in the apps in question.

Option 1 would be safer and more reliable and configurable from a single place. Option 2 would be easier to implement.

Upvotes: 0

Related Questions