Android Question Help with Error DatabaseReference.Initialize en Firebase Realtimedatabase

Alex Guerrero

Member
Licensed User
Longtime User
Hello, I am testing the example of Firebase Realtimedatabase and I have the following error, please can you help me, thanks in advance.

Can you help me with the method : Initialize, which would be the correct parameters according to my structure.


B4X:
Dim ref As DatabaseReference
    ref.Initialize("Reference",realtime.getReferencefromUrl("https://tu.garage.com-8b2a8.firebaseio.com/") ,"midata")

Perform the installation according to https://www.b4x.com/b4a.html#installation

I have Win 7, B4A 8.0, Java 1.8.0_161, android-27
I install android with Sdk Manager, as you recommend it
I have enabled permissions in firebase

Text translated with google.

error_compile.jpg Firebase_struct.jpg
 
Last edited:

Alex Guerrero

Member
Licensed User
Longtime User
I have solved in part by adding the following lines.

B4X:
    #AdditionalRes: ..\resource
    #AdditionalJar: com.android.support.constraint:constraint-layout
    #AdditionalJar: com.google.android.gms:play-services-base
    #AdditionalJar: com.google.firebase:firebase-core
    #AdditionalJar: com.google.firebase:firebase-database

My specific question is what is the correct way to initialize "DatabaseReference": 2 or 3 parameters and please expand the description if possible of the parameters. In the same way, which is the best way to refer to the database with "FirebaseDatabase".

Sorry but I have problems with understanding the connection to a BD NoSQL.
 

Attachments

  • resource.zip
    4.7 KB · Views: 311
  • rutas_b4x.jpg
    rutas_b4x.jpg
    45.9 KB · Views: 299
  • SDK_B4x.jpg
    SDK_B4x.jpg
    72.9 KB · Views: 274
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
My specific question is what is the correct way to initialize "DatabaseReference"
As you are using the json file from firbase your app already know the Database. You just can use

B4X:
    Dim servicio As DatabaseReference
    servicio.Initialize("servicio",realtime.getReference2("servicio/"),"servicio/")

"servicio" is the Event-Prefix for the Events
The 1st "servicio/" is the Path you want to get
The 2nd is a Tag which you can use
 
Upvote 0
Top