FirebaseRealtimeDatabase4j
Author: DonManfred (wrapper)
Version: 1
Requirements:
- B4J and two 3rd Party JARs. You can download them HERE. Copy the cotentof the ZIP to your B4J Additional Libs folder. Together with the Library (jar and xml) attached here.
Please note that the lib is NOT tested as yet...
Try it by yourself. Get inspiration of the needed B4J Code while looking at the B4A Library i wrote... The code should be kind of the same.
Have fun and good luck ;-)
Author: DonManfred (wrapper)
Version: 1
Methods:- toString As String
- Name As String
- Phone As Long
- Surname As String
- DataSnapshot
Methods:- Initialize (snapshot As DataSnapshot)
- IsInitialized As Boolean
- Value2Map (value As Object) As Object
- exists As Boolean
Returns true if the snapshot
contains a non-null value. - getChild (path As String) As DataSnapshot
Get a DataSnapshot for the location
at the specified relative path. - hasChild (child As String) As Boolean
Can be used to determine if this
DataSnapshot has data at a
particular location - hasChildren As Boolean
- Children As Iterable [read only]
Gives access to all of the
immediate children of this snapshot. - ChildrenCount As Long [read only]
- Key As String [read only]
- Priority As Object [read only]
Returns the priority of the data
contained in this snapshot as a
native type. - Ref As DatabaseReference [read only]
Used to obtain a reference to
the source location for this
snapshot. - Value As Object [read only]
- 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
- Initialize (error As DatabaseError)
- IsInitialized As Boolean
- Code As Int [read only]
returns One of the defined status codes,
depending on the error - Details As String [read only]
returns Human-readable details on the
error and additional information,
e.g. links to docs; - Message As String [read only]
returns a human-readable description of the error
- DatabaseReference
Events:- onCancelled (errnum as Int As , error As String, errObj As Object)
- onChildAdded (snapshot As Object, child As String)
- onChildChanged (snapshot As Object, child As String)
- onChildMoved (snapshot As Object, child As String)
- onChildRemoved (snapshot As Object)
- onComplete (errorCode As Int, errorMessage As String, errObj As Object, dbRef As Object)
- onDataChange (snapshot As Object)
- Child (child As String) As DatabaseReference
Get a reference to location
relative to this one - Database As FirebaseDatabase
Gets the Database instance associated
with this reference. - Initialize (EventName As String, reference As DatabaseReference)
- IsInitialized As Boolean
- LimitToFirst (count As Int) As Query
- LimitToLast (count As Int) As Query
- Parent As DatabaseReference
- Ref As DatabaseReference
- Root As DatabaseReference
- Value2Map (value As Object) As Object
- addChildEventListener
- addListenerForSingleValueEvent
- addValueEventListener
- goOffline
Manually disconnect the Firebase Database
client from the server and disable
automatic reconnection. - goOnline
Manually reestablish a connection to the
Firebase Database server and enable
automatic reconnection. - keepSynced (keepSynced As Boolean)
By calling `keepSynced(true)` on a location, the data for that
location will automatically be downloaded and kept in sync,
even when no listeners are attached for that location. - newMap As Object
- orderByChild (child As String) As Query
- orderByKey As Query
- orderByPriority As Query
- orderByValue As Query
- push As DatabaseReference
Create a reference to an auto-
generated child location. - removeValue
Set the value at this location to 'null' - setEventName (EventName As String)
- updateChildren (EventName As String, map As Map)
- Key As String [read only]
- Value As Map [write only]
- FirebaseDatabase
Methods:- Initialize (EventName As String, jsonfile As String, databaseUrl As String)
Gets the instance of FirebaseDatabase
for the default FirebaseApp. - IsInitialized As Boolean
- Initialize (EventName As String, jsonfile As String, databaseUrl As String)
- FirebaseDatabase
Methods:- Initialize (EventName As String)
Gets the instance of FirebaseDatabase
for the default FirebaseApp. - IsInitialized As Boolean
- Value2Map (value As Object) As Object
- getReference (path As String) As DatabaseReference
Gets a DatabaseReference for
the provided path. - getReferencefromUrl (url As String) As DatabaseReference
Gets a DatabaseReference
for the provided URL. - goOffline
Shuts down our connection to the Firebase
Database backend until goOnline() is called. - goOnline
Resumes our connection to the Firebase
Database backend after a previous
goOffline() call. - orderByValue As Query
- purgeOutstandingWrites
The Firebase Database client automatically
queues writes and sends them to the server
at the earliest opportunity, depending on
network connectivity.
- App As FirebaseApp [read only]
Returns the FirebaseApp instance to
which this FirebaseDatabase belongs. - LogLevel As Level [write only]
By default, this is set to INFO. - PersistenceEnabled As Boolean [write only]
The Firebase Database client will cache synchronized
data and keep track of all writes you've initiated
while your application is running.
- Initialize (EventName As String)
- Query
Methods:- Initialize (qry As Query)
The Query class (and its subclass, DatabaseReference) are
used for reading data. Listeners are attached, and they will
be triggered when the corresponding data changes.
Instances of Query are obtained by calling startAt(),
endAt(), or limit() on a DatabaseReference. - IsInitialized As Boolean
- LimitToFirst (count As Int) As QueryWrapper
Create a query with limit and anchor
it to the start of the window - LimitToLast (count As Int) As QueryWrapper
Create a query with limit and anchor it
to the end of the window - endAtBool (value As Boolean, key As String) As QueryWrapper
Create a query constrained to only return child nodes
with a value less than or equal to the given value,
using the given orderBy directive or priority as
default, and additionally only child nodes with a
key less than or equal to the given key. - endAtBool2 (value As Boolean) As QueryWrapper
Create a query constrained to only return child nodes
with a value less than or equal to the given value,
using the given orderBy directive or priority as default. - endAtDouble (value As Double, key As String) As QueryWrapper
Create a query constrained to only return child nodes
with a value less than or equal to the given value,
using the given orderBy directive or priority as
default, and additionally only child nodes with a
key less than or equal to the given key. - endAtDouble2 (value As Double) As QueryWrapper
Create a query constrained to only return child nodes
with a value less than or equal to the given value,
using the given orderBy directive or priority as default. - endAtString (value As String, key As String) As QueryWrapper
Create a query constrained to only return child nodes
with a value less than or equal to the given value,
using the given orderBy directive or priority as
default, and additionally only child nodes with a
key key less than or equal to the given key. - endAtString2 (value As String) As QueryWrapper
Create a query constrained to only return child nodes
with a value less than or equal to the given value,
using the given orderBy directive or priority as default. - keepSynced (keepSynced As Boolean)
By calling `keepSynced(true)` on a location, the data for that
location will automatically be downloaded and kept in sync,
even when no listeners are attached for that location. - orderByChild (child As String) As QueryWrapper
Create a query in which child nodes are
ordered by the values of the specified path. - orderByKey As QueryWrapper
Create a query in which child nodes are
ordered by their keys. - orderByPriority As QueryWrapper
Create a query in which child nodes are
ordered by their priorities. - orderByValue As QueryWrapper
Create a query in which nodes are
ordered by their value - query As Query
- Initialize (qry As Query)
Requirements:
- B4J and two 3rd Party JARs. You can download them HERE. Copy the cotentof the ZIP to your B4J Additional Libs folder. Together with the Library (jar and xml) attached here.
Please note that the lib is NOT tested as yet...
Try it by yourself. Get inspiration of the needed B4J Code while looking at the B4A Library i wrote... The code should be kind of the same.
Have fun and good luck ;-)
Attachments
Last edited: