Public Sub SubscribeToTopics
topic = Starter.DeviceID
Sleep(0)
Do While fm.Token = Null
Sleep(500)
Loop
Dim token As String = fm.Token
Log("SubscribeToTopics fm-token = "&token)
If token <> "" Then
Log("Register Device with Token: "&token)
Dim j As HttpJob
j.Initialize("",Me)
j.Download2(Starter.BridgeURL,Array As String("action","register","token",fm.Token,"deviceID",Starter.DeviceID))
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(token) 'you can subscribe to more topics
fm.SubscribeToTopic(topic) 'you can subscribe to more topics
End Sub