thanks Don!
Sorry, but how do I do this? You need to have a DocumentReference for the Docuent you want to change
my code
Public Sub ubicacionmodificada(Location1 As Location) ' gps actualizacion de ubicacion
fs.Initialize("Firestore",True)
loc.Initialize(Location1.Latitude,Location1.Longitude)
Dim usuarios As CollectionReference= fs.collection("usuarios","usuarios_coleccion")
If Starter.auth.CurrentUser.IsInitialized Then
If usuarios <> Null Then
' usuarios.setEventname("resultadovalidaciondatosusuario","Userlist")
usuarios.whereEqualTo("usuario_Uid",Starter.auth.CurrentUser.Uid).limit(25).fetch("usuarioscambiogps")
End If
End If
End Sub
Sub usuarioscambiogps_snapshot(success As Boolean, data As QuerySnapshot, info As String)
fs.Initialize("Firestore",True)
If data.Size > 0 Then
Log ("usuario cambio gps:" & success)
Dim documento As List = data.Documents
Dim cambio As DocumentReference
If documento.IsInitialized Then
'If documento > 0 Then
For i = 0 To documento.Size-1
Dim docsnap As DocumentSnapshot = documento.Get(i)
Dim cambio_gps As DocumentReference
Dim ref As DocumentReference = data.Documents ' you need to have this already
ref.setEventname("UserWatch","Update")
Log("DocumentReferenceId: "&ref.Id)
Dim m As Map = CreateMap("Nombre": "gabrielanew")
ref.merge(m,"update") ' add Nombre field to document replacing the existing Field.
Next
End If
End If
End Sub
Generated this error
main_usuarioscambiogps_snapshot (java line: 981)
java.lang.ClassCastException: java.util.ArrayList cannot be cast to com.google.firebase.firestore.DocumentReference
at com.aeropuerto.myapp.main._usuarioscambiogps_snapshot(main.java:981)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at anywheresoftware.b4a.BA$2.run(BA.java:370)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5593)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)