mirror of
https://gitee.com/farsunset/cim.git
synced 2025-07-27 02:20:32 +08:00
修改一处android-cim-sdk可能出现ConcurrentModificationException的问题
This commit is contained in:
parent
0f38754cda
commit
41327dd79e
Binary file not shown.
@ -124,7 +124,10 @@ public class CIMPushManager {
|
||||
if (isDestroyed(context) || isStopped(context)) {
|
||||
return;
|
||||
}
|
||||
context.sendBroadcast(new Intent(ACTION_CIM_CONNECTION_PONG));
|
||||
|
||||
Intent serviceIntent = new Intent(context, CIMPushService.class);
|
||||
serviceIntent.setAction(ACTION_CIM_CONNECTION_PONG);
|
||||
startService(context, serviceIntent);
|
||||
}
|
||||
|
||||
private static void sendBindRequest(Context context, String account) {
|
||||
|
@ -62,7 +62,6 @@ public class CIMPushService extends Service {
|
||||
|
||||
private CIMConnectorManager connectorManager;
|
||||
private KeepAliveBroadcastReceiver keepAliveReceiver;
|
||||
private InnerEventBroadcastReceiver innerEventReceiver;
|
||||
private ConnectivityManager connectivityManager;
|
||||
private NotificationManager notificationManager;
|
||||
private final AtomicBoolean persistHolder = new AtomicBoolean(false);
|
||||
@ -73,9 +72,6 @@ public class CIMPushService extends Service {
|
||||
connectorManager = CIMConnectorManager.getManager(this.getApplicationContext());
|
||||
notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
innerEventReceiver = new InnerEventBroadcastReceiver();
|
||||
registerReceiver(innerEventReceiver, innerEventReceiver.getIntentFilter());
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
keepAliveReceiver = new KeepAliveBroadcastReceiver();
|
||||
registerReceiver(keepAliveReceiver, keepAliveReceiver.getIntentFilter());
|
||||
@ -156,6 +152,10 @@ public class CIMPushService extends Service {
|
||||
this.stopSelf();
|
||||
}
|
||||
|
||||
if (CIMPushManager.ACTION_CIM_CONNECTION_PONG.equals(action)) {
|
||||
connectorManager.send(Pong.getInstance());
|
||||
}
|
||||
|
||||
if (CIMPushManager.ACTION_SET_LOGGER_EATABLE.equals(action)) {
|
||||
boolean enable = intent.getBooleanExtra(KEY_LOGGER_ENABLE, true);
|
||||
CIMLogger.getLogger().debugMode(enable);
|
||||
@ -239,9 +239,6 @@ public class CIMPushService extends Service {
|
||||
|
||||
persistHolder.set(false);
|
||||
|
||||
unregisterReceiver(innerEventReceiver);
|
||||
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
unregisterReceiver(keepAliveReceiver);
|
||||
}
|
||||
@ -322,20 +319,4 @@ public class CIMPushService extends Service {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class InnerEventBroadcastReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
connectorManager.send(Pong.getInstance());
|
||||
}
|
||||
|
||||
public IntentFilter getIntentFilter() {
|
||||
IntentFilter intentFilter = new IntentFilter();
|
||||
intentFilter.addAction(CIMPushManager.ACTION_CIM_CONNECTION_PONG);
|
||||
return intentFilter;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user