ReconnectionManager in asmack

后端 未结 4 491
野的像风
野的像风 2021-01-03 06:17

I have a project on Android, which needs to use asmack library to enable real time chat.

The key feature is reconnecting mechanism, that means my application can rec

4条回答
  •  一整个雨季
    2021-01-03 06:34

    Don't use reconnection mechanism which is implemented in ASMACK.

    Use:

        connConfig.setReconnectionAllowed(false);
    

    Instead, you should create BroadcastReceiver which listens to ConnectivityManager.CONNECTIVITY_ACTION. When connection to WIFI or other network is occurred, then you will receive the callback onReceive in your BroadcastReceiver.

提交回复
热议问题