I have read the other posts about this issue, but I still have a question.
When I read a NFC tag everything works fine when the main activity is paused.
When app is running I get the message (Killing previous instance (main).)
It is not a problem that the activity is created again, but my MQTT connection is terminated too.
The MQTT connection is running in a separated service with StartForeground.
Reading the NFC should result in sending an MQTT message but Killing previous instance terminates connection to MQTT server.
I could put all MQTT messages in a queue and send them once I am connected again, but I hope someone have a better solution.
When I read a NFC tag everything works fine when the main activity is paused.
When app is running I get the message (Killing previous instance (main).)
It is not a problem that the activity is created again, but my MQTT connection is terminated too.
The MQTT connection is running in a separated service with StartForeground.
Reading the NFC should result in sending an MQTT message but Killing previous instance terminates connection to MQTT server.
I could put all MQTT messages in a queue and send them once I am connected again, but I hope someone have a better solution.