This is is a wrap for the Firebase RealtimeDatabase.
Please click here to donate for my work to write the wrapper (You can donate any amount you want but the minimum donation should be $10 for this Library)
Please note that this version is not known as stable but - for me - it seems to be working like i expect it
I don´t know if everything works but so far i tested it today it works
Please note that the wrap for the Query object is NOT finished. Also others may be incomplete...
To prepare you app you need to use B4A 6+ and you need to follow the Firebase integration and download the json from the firebaseonsole!
If you have successfully connected your appwith firebase the library will know the Database used.
What you need to do is to get a reference to a specific tree in the database-tree
FirebaseRealtimeDatabase
Author: DonManfred
Version: 2.82
The code will get a reference to the root database... You can for sure get a ref to any "subfolder" inside the db.
Please click here to donate for my work to write the wrapper (You can donate any amount you want but the minimum donation should be $10+ for this Library)
Setup:
Download the 3rdparty jars from --->DOWNLOAD HERE<---. Due to their size i needed to place it on my Dropbox. Copy the content to your additional libs folder.
Download the most up to date libraryfiles (FirebaseRealtimeDatabaseVx.xx.zip) and put the content to your additional libs folder.
Please click here to donate for my work to write the wrapper (You can donate any amount you want but the minimum donation should be $10 for this Library)
Please note that this version is not known as stable but - for me - it seems to be working like i expect it
I don´t know if everything works but so far i tested it today it works
Please note that the wrap for the Query object is NOT finished. Also others may be incomplete...
To prepare you app you need to use B4A 6+ and you need to follow the Firebase integration and download the json from the firebaseonsole!
If you have successfully connected your appwith firebase the library will know the Database used.
What you need to do is to get a reference to a specific tree in the database-tree
FirebaseRealtimeDatabase
Author: DonManfred
Version: 2.82
- DataSnapshot
- Functions:
- exists As Boolean
- getChild (child As String) As DataSnapshot
- hasChild (paramString As String) As Boolean
- hasChildren As Boolean
- Initialize (paramDataSnapshot As com.google.firebase.database.DataSnapshot)
- Value2Map (paramObject As Object) As Object
- exists As Boolean
- Properties:
- Children As List [read only]
- ChildrenCount As Long [read only]
- DBRef As DatabaseReference [read only]
- Key As String [read only]
- Priority As Object [read only]
- Value As Object [read only]
- Value2 As Object [read only]
- Children As List [read only]
- Functions:
- DatabaseError
- Fields:
- DATA_STALE As Int
- DISCONNECTED As Int
- EXPIRED_TOKEN As Int
- INVALID_TOKEN As Int
- MAX_RETRIES As Int
- NETWORK_ERROR As Int
- OPERATION_FAILED As Int
- OVERRIDDEN_BY_SET As Int
- PERMISSION_DENIED As Int
- UNAVAILABLE As Int
- UNKNOWN_ERROR As Int
- USER_CODE_EXCEPTION As Int
- WRITE_CANCELED As Int
- DATA_STALE As Int
- Functions:
- Initialize (paramDatabaseError As com.google.firebase.database.DatabaseError)
- IsInitialized As Boolean
- Initialize (paramDatabaseError As com.google.firebase.database.DatabaseError)
- Properties:
- Code As Int [read only]
- Details As String [read only]
- Message As String [read only]
- Code As Int [read only]
- Fields:
- DatabaseReference
- Events:
- onCancelled (errorCode As Int, errorMessage As String, error As Object, tag As Object)
- onChildAdded (Snapshot As Object, child As String, tag As Object)
- onChildChanged (Snapshot As Object, child As String, tag As Object)
- onChildMoved (Snapshot As Object, child As String, tag As Object)
- onChildRemoved (Snapshot As Object, tag As Object)
- onComplete (resultCode As Int, resultMessage As String, result As Object)
- onDataChange (Snapshot As Object, tag As Object)
- Functions:
- addChildEventListener
Add a ChildEvent-Listener
If a change occur on a Child then
there are some Events which can raise.
onChildAdded holding a DatabaseSnapshot
of the added Child.
onChildChanged holding a DatabaseSnapshot
of the changed child.
onChildMoved holding a DatabaseSnapshot
of the moved child.
onChildRemoved holding a DatabaseSnapshot
of the removed child. - addListenerForSingleValueEvent
Add a listener for ANY change.
If any changes occur then the
Event onDataChange is raised holding
a DatabaseSnapshot in total. - addValueEventListener
- Child (child As String) As DatabaseReference
- equalTo (reference As String) As FBQuery
- equalTo2 (child As String, reference As String) As FBQuery
- goOffline
- goOnline
- Initialize (EventName As String, parref As com.google.firebase.database.DatabaseReference, tag As Object)
- IsInitialized As Boolean
- keepSynced (sync As Boolean)
- LimitToFirst (limit As Int) As FBQuery
- LimitToLast (limit As Int) As FBQuery
- onDisconnectCancel
- onDisconnectRemove
- onDisconnectSetValue (value As Map)
- orderByChild (child As String) As FBQuery
- orderByKey As FBQuery
- orderByPriority As FBQuery
- orderByValue As FBQuery
- push As DatabaseReference
- removeValue
- setEventname (EventName As String, Tag As Object) As DatabaseReference
- setValue (content As Map, child As String, EventName As String)
- updateChildren (paramMap As Map)
- addChildEventListener
- Properties:
- BA As BA [read only]
- EventName As String [read only]
- Key As String [read only]
- Parent As DatabaseReference [read only]
- Ref As DatabaseReference [read only]
- Root As DatabaseReference [read only]
- Tag As Object
- BA As BA [read only]
- Events:
- DocumentSnapshot
- Functions:
- exists As Boolean
- getChild (child As String) As DocumentSnapshot
- hasChild (paramString As String) As Boolean
- hasChildren As Boolean
- Initialize (paramDataSnapshot As com.google.firebase.database.DataSnapshot)
- IsInitialized As Boolean
- setEventname (EventName As String, Tag As Object) As DocumentSnapshot
- Value2Map (paramObject As Object) As Object
- exists As Boolean
- Properties:
- Children As List [read only]
- ChildrenCount As Long [read only]
- EventName As String [read only]
- Key As String [read only]
- Priority As Object [read only]
- Ref As DatabaseReference [read only]
- Tag As Object
- Value As Object [read only]
- Value2 As Object [read only]
- Children As List [read only]
- Functions:
- FBQuery
- Events:
- Snapshot (sign As Object)
- Functions:
- addChildEventListener
- addListenerForSingleValueEvent
- addValueEventListener
- Initialize (EventName As String, query As com.google.firebase.database.Query)
- limitToFirst (limit As Int) As FBQuery
- limitToLast (limit As Int) As FBQuery
- orderByChild (path As String) As FBQuery
- startAt (arg0 As String, arg1 As String) As FBQuery
- addChildEventListener
- Properties:
- QueryObj As Object [read only]
- Tag As Object
- QueryObj As Object [read only]
- Events:
- FireLayout
- Events:
- onFireLayoutChildClicked (view As Object)
- onFireLayoutChildLongClicked (view As Object)
- Functions:
- BringToFront
- DesignerCreateView (base As Panel, lw As Label, props As Map)
- init
- Initialize (EventName As String)
- Invalidate
- Invalidate2 (arg0 As android.graphics.Rect)
- Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- IsInitialized As Boolean
- RemoveView
- RequestFocus As Boolean
- SendToBack
- SetBackgroundImage (arg0 As android.graphics.Bitmap) As BitmapDrawable
- SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
- SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- BringToFront
- Properties:
- Background As android.graphics.drawable.Drawable
- Color As Int [write only]
- Enabled As Boolean
- Height As Int
- Id As Int [read only]
- Left As Int
- Padding As Int()
- Parent As Object [read only]
- Tag As Object
- Top As Int
- Visible As Boolean
- Width As Int
- Background As android.graphics.drawable.Drawable
- Events:
- FirebaseDatabase
- Functions:
- getReference2 (path As String) As DatabaseReference
- getReferencefromUrl (url As String) As DatabaseReference
- goOffline
- goOnline
- Initialize (EventName As String)
- orderByValue As FBQuery
- purgeOutstandingWrites
- Value2Map (value As Object) As Object
- getReference2 (path As String) As DatabaseReference
- Properties:
- LogLevel As com.google.firebase.database.Logger.Level [write only]
- PersistenceEnabled As Boolean [write only]
- Reference As DatabaseReference [read only]
- LogLevel As com.google.firebase.database.Logger.Level [write only]
- Functions:
- GeoFire
- Events:
- onComplete (key As String, error As Databaseerror)
- onDataChanged (datasnapshot As DataSnapshot, location As GeoLocation)
- onDataEntered (datasnapshot As DataSnapshot, location As GeoLocation)
- onDataExited (datasnapshot As DataSnapshot)
- onDataMoved (datasnapshot As DataSnapshot, location As GeoLocation)
- onGeoQueryError (error As Databaseerror)
- onGeoQueryReady()
- onKexExited (key As String)
- onKeyEntered (key As String, location As GeoLocation)
- onKeyMoved (key As String, location As GeoLocation)
- Functions:
- addGeoQueryDataEventListener
- addGeoQueryEventListener
- Initialize (EventName As String, lat As Double, lon As Double, radius As Double)
- setLocation (key As String, location As com.firebase.geofire.GeoLocation)
- setQueryCenter (center As com.firebase.geofire.GeoLocation, radius As Double)
- addGeoQueryDataEventListener
- Properties:
- Center As com.firebase.geofire.GeoLocation
- Radius As Double
- Center As com.firebase.geofire.GeoLocation
- Events:
- GeoLocation
- Functions:
- Initialize (lat As Double, lon As Double)
- IsInitialized As Boolean
- Initialize (lat As Double, lon As Double)
- Properties:
- latitude As Double [read only]
- longitude As Double [read only]
- latitude As Double [read only]
- Functions:
B4X:
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim realtime As FirebaseDatabase
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
realtime.Initialize("Realtime")
realtime.PersistenceEnabled = True
realtime.goOnline
Dim myref As DatabaseReference
myref.Initialize("Reference",realtime.getReference2(""),"root")
End Sub
The code will get a reference to the root database... You can for sure get a ref to any "subfolder" inside the db.
B4X:
mymessages.Initialize("Chat",realtime.getReference2("users/"&Starter.phone.GetSettings("android_id")&"/Messages"),"users/"&Starter.phone.GetSettings("android_id")&"/Messages")
Please click here to donate for my work to write the wrapper (You can donate any amount you want but the minimum donation should be $10+ for this Library)
Setup:
Download the 3rdparty jars from --->DOWNLOAD HERE<---. Due to their size i needed to place it on my Dropbox. Copy the content to your additional libs folder.
Download the most up to date libraryfiles (FirebaseRealtimeDatabaseVx.xx.zip) and put the content to your additional libs folder.
Attachments
-
firelayout.zip34.6 KB · Views: 1,097
-
volley-1.0.0.jar87.7 KB · Views: 977
-
FirebaseRaltimeDatabase-Additional.zip90.6 KB · Views: 1,217
-
firebase-ui-auth.zip383.8 KB · Views: 1,157
-
FirebaseRealtimeDatabaseV2.53.zip152.2 KB · Views: 1,153
-
FirebaseRealtimeDatabaseV2.82.zip56.5 KB · Views: 967
-
FirebaseRealtimeDatabaseEx.zip10 KB · Views: 1,038
Last edited: