Android Question Firebase Database REST and REALTIME Testproject [first approach]

fredo

Well-Known Member
Licensed User
Longtime User
It is better to use the latest version here

_______________________________________________
EDIT: The problem is solved here


Remark: USE ALWAYS @DonManfreds MOST RECENT Wrap of the Firebase-Realtime-Database-Library

The testproject is intended to help the community to get started with the Firebase Database as an useful addition to the RAD environment of B4X

It has two different activities to test the two variants of database access:
a) Realtime --> Event driven access to data
b) REST --> "representational state transfer" with commands integrated in an URL​

It is an extended version of the first REST project here.

Unfortunately this testproject is not finished yet:
- The REST part is working fine
- The REALTIME part is in a growing status with a problem in testfibart.writeNewPost(...) as

  • the push.key function of the library generates not the expected key fixed since 1.20
  • and the map for "updateChildren is not accepted
This project will be made available to the community as soon as the REALTIME part is finished.


Picture 1: Key-problem [Solved]
18-08-_2016_17-48-32.jpg

Picture 2: updateChildren problem
20-08-_2016_13-06-14.png


Link 1: https://firebase.google.com/docs/reference/android/com/google/firebase/database/DatabaseReference#push()

Link 2: https://github.com/firebase/quickst...base/quickstart/database/NewPostActivity.java

The following prerequisites should be done before the first test:
1. Be sure to have YOUR "google-services.json" file in your B4A project folder
2. Goto service module "Starter" and set up your Firebase parameters in Process_Globals
3. Set up your database RULES in the Firebase console
4. Set up Firebase auth
5. In the "Files"-folder is a file with testdata that you MAY IMPORT in the Firebase console: "fir-quickstartsforandroid-testdata.json"

It would be of great benefit to the community if this problem would be solved. So if anyone of you is able and willing to help it would be great.

Edit: testproject updated to version "12m" with minor changes

Tags: #FIBAS #Firebase #Firebasedatabase
 

Attachments

  • fredo_FiBaDb_tester_12m.zip
    81.3 KB · Views: 384
Last edited:

fredo

Well-Known Member
Licensed User
Longtime User
Oh - I'm glad someone else is interested in the Firebase Realtime Database.

How is this progressing?

@DonManfred wrapped a Library for that but it has two problems that seem unsolvable.
Problem #1: The "Push key" is not generated (like "-KOJ65eZv....")
Problem #2: runtime error "Map cannot be cast to java.util.map"​

If I had more knowledge of JAVA I would gladly try to wrap it. But I would have to start from almost zero.

I think it's a non trivial task since the wrapper has to have knowledge not only in JAVA and wrapping but also needs to know the Firebase Realtime Database concept and NoSQL database operations to verify the lib-functionality.

As far as I can see in this field I think the Firebase Realtime Database is unreachable for B4X.

However, should a team come together to solve this, I am willing to help on the B4A page with testprojects and tutorials.
In the meantime I'm searching for other possibilities to make my Android project work Realtime with Firebase, since it's the most easy way to implement a modern social app.
 
Upvote 0

pedrocam

Member
Licensed User
Longtime User
Hi, Although I am not technically able to help with the wrapper, I just wanted to say thank you for keepin at this. Also that using your example I was able to port the REST DB access to B4i as well and it works just like in B4a. Besides that I can only hope that the realtime database is eventually created! Thanks for all your help.
 
Upvote 0

fredo

Well-Known Member
Licensed User
Longtime User
I was able to port the REST DB access to B4i as well and it works just like in B4a
Great. It will be real useful for the B4i community.

Too bad the Firebase REALTIME library is practically dead for the B4X world.

What I don't understand is that no one is able to wrap it up to a 100% working lib.

According to http://stackoverflow.com/questions/...ltime-database-java-library-for-a-wrap-to-b4x the sources are available in the maven repository http://central.maven.org/maven2/com/google/firebase/firebase-server-sdk/3.0.1/.

21-09-_2016_08-52-10.jpg
 
Last edited:
Upvote 0

johndb

Active Member
Licensed User
Longtime User
Great. It will be real useful for the B4i community.

Too bad the Firebase REALTIME library is practically dead for the B4X world.

What I don't understand is that no one is able to wrap it up to a 100% working lib.

According to http://stackoverflow.com/questions/...ltime-database-java-library-for-a-wrap-to-b4x the sources are available in the maven repository http://central.maven.org/maven2/com/google/firebase/firebase-server-sdk/3.0.1/.

View attachment 48033
I have been following this thread with interest as the Firebase Realtime Database, in my opinion, would be an important addition to B4X.
@DonManfred - Is there any possibility that you can finish the library that you had started and inexplicably abandoned?

This is one of the last pieces of the Firebase puzzle :)

Thank you all,

John
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
This is one of the last pieces of the Firebase puzzle :)
I was not able to get it to run like we would expect in the b4a world.

In my understanding the problem is that we need to use java-classes to be fully compatible with the RT-Database.
All examples are using custom classes.
 
Upvote 0

johndb

Active Member
Licensed User
Longtime User
I was not able to get it to run like we would expect in the b4a world.

In my understanding the problem is that we need to use java-classes to be fully compatible with the RT-Database.
All examples are using custom classes.
Thank you for the update @DonManfred. Your work is always appreciated!
@Erel - Could you please advise us as to how we can integrate the Firebase Realtime Database into B4X?

Thank you,

John
 
Upvote 0

lymey

Active Member
Licensed User
Longtime User
I'm willing to help too, but have limited expertise in creating a wrapper, perhaps somebody would like to do it and get paid for it, and we could all contribute?:)
 
Upvote 0
Top