Public Sub SubscribeToTopics
topic = Starter.DeviceID
Log("SubscribeToTopics = fbdnkv2,"&topic)
Sleep(0)
If fm.IsInitialized Then
'Log("SubscribeToTopics fm isInitialized")
End If
'Log("SubscribeToTopics check token")
Dim token As String = fm.Token
Log("SubscribeToTopics fm-token = "&token)
If fm.Token <> "" Then
'Log("Register Device with Token: "&FirebaseMessaging.fm.Token)
Dim j As HttpJob
j.Initialize("",Me)
Log(Starter.BridgeURL&"?action=register&token="&fm.Token&"&deviceID="&Starter.DeviceID)
j.Download2(Starter.BridgeURL,Array As String("action","register","token",fm.Token,"deviceID",Starter.DeviceID, "modul","Service2Mobil", "uid",Starter.logged_userid))
wait for (j) JobDone(job As HttpJob)
If job.Success Then
Dim res As String = job.GetString
Log("Register Successfully")
Log(job.GetString)
job.Release
Else
LogColor("Error: "&job.ErrorMessage, Colors.Red)
job.Release
End If
End If
fm.SubscribeToTopic(topic) 'you can subscribe to more topics
End Sub