How to keep smack connection alive on android

Below is the code to create the smack connection, i am using the ServerPingWithAlarmManager and ReconnectionManager, but in some kind of android phone, the connection will disconnect some time when the phone is come into the deep sleep method,can someone help me on this about how to keep the smack connection alive in Android?Thanks in advance!

private void initConnection(String id,String passwd){

account = new AccountInfo();

account.getUser().setUsername(id);

account.getUser().setPassword(passwd);

XMPPTCPConnectionConfiguration.Builder config = XMPPTCPConnectionConfiguration.builder();

config.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);

config.setUsernameAndPassword(account.getUsername(), account.getPassword());

config.setServiceName(“linkhere”);

config.setHost(“123.56.145.82”);

config.setPort(ConfigPropertiesUtil.getImPort());

config.setSendPresence(true);//不要告诉服务器自己的状态 -接受离线消息

connection = new XMPPTCPConnection(config.build());

connection.setPacketReplyTimeout(10000);

connection.addConnectionListener(this);

ServerPingWithAlarmManager.onCreate(this);

ReconnectionManager.getInstanceFor(connection).enableAutomaticReconnection();

ServerPingWithAlarmManager.getInstanceFor(connection).setEnabled(true);

}