onDisconnectSetValue 'if you lost your conncection or the user is close the app, then you can set here a value, this is then set.
onDisconnectRemove 'the same, but only here is the value deleted.
	Sub Activity_Create(FirstTime As Boolean)
Dim typingref As DatabaseReference
Dim realtime As FirebaseDatabase
typingref.Initialize("istyping",realtime.getReference2("/rooms/" & "MyRoomId & "/typingIndicator"),"chats")
typingref.addChildEventListener
typingref.onDisconnectSetValue(CreateMap("MyIdOrColumn" : False)) 'if i disconnect or i lost my connection to the Database, then the Value set to false
'for example i write a text and then i lost my connection, then set the value to false and my chat partner know that i dont writing anymore, because i lost my connection.
typingref.goOnline
typingref.keepSynced(True)
End Sub
	Thank you for sharing!And now a example for using
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim realtime As FirebaseDatabase
    Dim msgref As DatabaseReference
    Public phone As Phone
End Sub
Sub Service_Create
    'This is the program entry point.
    'This is a good place to load resources that are not specific to a single activity.
End Sub
Sub Service_Start (StartingIntent As Intent)
    realtime.Initialize("Realtime")
    realtime.PersistenceEnabled = True
    realtime.goOnline
    ' I´m getting a reference to a specific sub-node of the Database. In this case /users/xxxxx/Messages
    ' Here i am storing Messages from this user. 
    msgref.Initialize("Reference",realtime.Reference.Child("users/"&phone.GetSettings("android_id")&"/Messages"),"users/"&phone.GetSettings("android_id")&"/Messages")
    Dim qry As FBQuery
    qry.Initialize("QueryResult",msgref.orderByChild("time").QueryObj) ' Order by
    qry.limitToFirst(3).addListenerForSingleValueEvent
End Sub
	Logger connected to: 988ad036525346515630
--------- beginning of main
--------- beginning of system
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
lib1:Raising.. queryresult_ondatachange()
QueryResult_onDataChange()
{Message=You are great, Title=this is the subject, From=ErelClone, time=1546412882568}
{Message=Hi Master, Title=My subject, From=ErelClone, time=1546412818120}
{Message=Hi Master, Title=MyGreatSubject, From=AnotherUser, time=1546412641788}
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
Error occurred on line: 74 (Starter)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
    at anywheresoftware.b4a.keywords.Common.GetType(Common.java:754)
    at com.b4atest.starter._queryresult_ondatachange(starter.java:217)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at anywheresoftware.b4a.BA$2.run(BA.java:370)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6923)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
	not reallyIs it still being maintained
noor is there something official about
What library is used? ---> Dim ref As DatabaseReference
Download the most up to date libraryfiles (FirebaseRealtimeDatabaseVx.xx.zip) and put the content to your additional libs folder.
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 ref As DatabaseReference
    ref.Initialize("Reference",realtime.getReferencefromUrl("https://fooddelivery-5f3bb.firebaseio.com"))
    ref.addChildEventListener
    ref.addListenerForSingleValueEvent
    ref.addValueEventListener
    Log("ref imagesizes = "&ref.Child("imagesizes"))
	but in example project , code writen in 2 parameter #85 , what the problem? or my1. You should always create a new thread in the questionsforum for any Issue you have. Posting to existing threads is a mistake.
2. The error suggests that you forgot a , here. DatabaseReference needs three parameters. The Eventprefix, the reference to your db and an Tag object.
B4A Version: 10.70
Parsing code.    (0.02s)
    Java Version: 11
Building folders structure.    (0.01s)
Compiling code.    (0.03s)
Compiling layouts code.    (0.00s)
Organizing libraries.    (0.03s)
    (AndroidX SDK)
Compiling resources    (0.61s)
Linking resources    (0.47s)
Compiling generated Java code.    (3.29s)
Convert byte code - dex.    Error
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
1 error; aborting
	There is a good reason why this library is in the Library archive.I am using this library and the example posted on one of B4A tutorial series on internet.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?