How can I stop MqttService when I exit from application?
MqttServiceDelegate.stopService(this) doesn't work:
17:34:32,,main,DEBUG,initLog: Logging to [/storage/emulated/0/log/MqttService.csv]
17:34:32,,main,DEBUG,changeStatus -> INITIAL
17:34:32,,main,DEBUG,onStartCommand: intent=Intent { cmp=b2ba60cdace202a2.myapp.mqtt/.services.MqttService }, flags=0, startId=1
17:34:32,,main,DEBUG,init(serverURI=tcp://99.99.99.99:1883, clientId=b2ab60ccac2552a2, persistence=null)
17:34:32,,main,DEBUG,setCallback(callback=b2ba60cdace202a2.myapp.mqtt.services.MqttService@21cb9b90)
17:34:32,,pool-5-thread-1,DEBUG,handleStart
17:34:32,,pool-5-thread-1,DEBUG,changeStatus -> CONNECTING
17:34:32,,pool-5-thread-1,DEBUG,connectToBroker
17:34:32,,pool-5-thread-1,DEBUG,connect(options=b2ba60cdace202a2.myapp.mqtt.impl.MqttConnectOptions@21f597f0)
17:34:32,,pool-5-thread-1,DEBUG,changeStatus -> CONNECTED
17:34:32,,pool-5-thread-1,DEBUG,subscribeToTopics
17:34:32,,pool-5-thread-1,DEBUG,subscribe(topics=[Lb2ba60cdace202a2.myapp.mqtt.interfaces.IMqttTopic;@21f56858)
17:34:32,MqttService$NetworkConnectionIntentReceiver,main,WARN,onReceive: isOnline()=true, isConnected()=true
[...]
17:35:05,,pool-5-thread-2,DEBUG,handleStart
17:35:05,,pool-5-thread-2,DEBUG,handleStartAction: action == MQTT_PUBLISH_MSG_INTENT
17:35:05,,pool-5-thread-2,DEBUG,handlePublishMessageIntent: intent=Intent { act=b2ba60cdace202a2.myapp.mqtt.services.mqtt.SENDMSG cmp=b2ba60cdace202a2.myapp.mqtt/.services.MqttService (has extras) }
17:35:05,,pool-5-thread-2,DEBUG,publish(topic=b2ba60cdace202a2.myapp.mqtt.impl.MqttTopic@222191d0, message=b2ba60cdace202a2.myapp.mqtt.impl.MqttMessage@222191c0)
17:35:05,,MQTT Call: b2ba60cdace202a2,DEBUG,deliveryb2ba60cdace202a2plete: org.eclipse.paho.client.mqttv3.MqttDeliveryToken@2219e878
[stopService called]
17:35:07,,main,DEBUG,onDestroy
17:35:07,,main,DEBUG,disconnectFromBroker
17:35:07,,main,DEBUG,initLog: Logging to [/storage/emulated/0/log/MqttService.csv]
17:35:07,,main,DEBUG,changeStatus -> INITIAL
17:35:07,,main,DEBUG,onStartb2ba60cdace202a2mand: intent=Intent { act=b2ba60cdace202a2.myapp.mqtt.services.mqtt.SENDMSG cmp=b2ba60cdace202a2.myapp.mqtt/.services.MqttService (has extras) }, flags=0, startId=1
17:35:07,,main,DEBUG,init(serverURI=tcp://99.99.99.99:1883, clientId=b2ba60cdace202a2, persistence=null)
17:35:07,,main,DEBUG,setCallback(callback=b2ba60cdace202a2.myapp.mqtt.services.MqttService@21d14a48)
How can I stop MqttService when I exit from application?
MqttServiceDelegate.stopService(this) doesn't work:
[...]
[stopService called]