Android Question MQTT sending message to waiting queue

viriato

Member
Licensed User
Longtime User
Hi All,
I have a working MQTT client application and I created additional Activity (GUI)
When I start the new Activity I load the GUI and i can publish on MQTT server
But I am not receiving the subscribed topics , they go to the "queue" then back to "main" I get all the messages in the queue. message below
sending message to waiting queue (mqttclient_messagearrived)
Any suggestion or example to handle the "mqttclient_MessageArrived" when switching between activities ?

Thanks
 

DonManfred

Expert
Licensed User
Longtime User
Use a service to do the communication.
In the service you need to know which activty is running to forward the incoming message to the right activity from the mqttclient_messagearrived event.
You can use the Starter service for this.
 
Upvote 0

viriato

Member
Licensed User
Longtime User
HI,
The problem is the fact the MQTT messages arrive asynchronous then i would like to dispatch to the active "Activity" GUI
But as soon I start the "activity" GUI the messages from MQTT goes to the "queue"

Thanks
 
Upvote 0
Top