Paho MQTT Android service wake up activity

后端 未结 5 1964
独厮守ぢ
独厮守ぢ 2021-01-02 14:36

I am trying to use Paho Android MQTT library (downloaded from here). The sample service application works fine, the subscribe and the publish meth

5条回答
  •  清酒与你
    2021-01-02 15:08

    If by 'close' you mean 'force stop' the app, then yes that completely stops the app and you won't receive messages (but that's probably what the user wanted anyways).

    If however, by 'close' you mean the user/android killing the app, then you are not receiving notifications because you are not 'connected' the broker anymore.

    A solution would be to create a custom Service to manage connections.

    Checkout my answer here for a detailed solution of what worked for me.

提交回复
热议问题