Ola
I'm attempting to subscribe to a list of topics in firebase. This should happen when the user logs in before the dashboard is shown.
This works however I'm not sure whether calling banano.await(fetch) is proper in this case. Sleep(1000) of course seems to be necessary.
Yes, I want to ensure that the subscriptions happen "before" the login screen is hidden.
Thanks,
I'm attempting to subscribe to a list of topics in firebase. This should happen when the user logs in before the dashboard is shown.
B4X:
'we need to subscribe to each of the topics
Dim mytopics As List = Array As String("banano", sdeviceid, stel1, stel2, stopicarea)
'
For Each strtopic As String In mytopics
If strtopic = "" Then Continue
'subscribe using fetch
Dim response As BANanoFetchResponse
Dim error As BANanoObject
'subscribe to each topic
Dim fetch As BANanoFetch = firebase.messaging.subscribe(strtopic)
banano.Await(fetch)
fetch.Then(response)
Dim Done As Boolean = firebase.messaging.IsSubscribed(response)
banano.Console.Log($"Subscribe to topic: ${strtopic}, ${Done}"$)
fetch.Else(error)
banano.Console.Log($"Could not subscribe to topic: ${strtopic}"$)
fetch.End
Sleep(1000)
Next
This works however I'm not sure whether calling banano.await(fetch) is proper in this case. Sleep(1000) of course seems to be necessary.
Yes, I want to ensure that the subscriptions happen "before" the login screen is hidden.
Thanks,