package com.hdl.hdllinphonesdk.core.linphone; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; import com.hdl.hdllinphonesdk.core.service.HDLLinphoneService; import com.hdl.hdllinphonesdk.utils.HDLLog; /** * KeepAliveHandler */ public class KeepAliveHandler extends BroadcastReceiver { private static final String TAG = "KeepAliveHandler"; @Override public void onReceive(Context context, Intent intent) { if (HDLLinphoneService.isReady() && HDLLinphoneService.getCore() != null) { HDLLinphoneService.getCore().refreshRegisters(); // SPUtils.save(context, "keepAlive", true); try { Thread.sleep(2000); } catch (InterruptedException e) { HDLLog.e(TAG, "Cannot sleep for 2s"); } } } }