1.广播接收者会启动两个CameaList
public class EzvizBroadcastReceiver extends BroadcastReceiver {
private static final String TAG = "EzvizBroadcastReceiver";
Intent toIntent =null;
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals(Constant.OAUTH_SUCCESS_ACTION)) {
Log. e(TAG, "onReceive: OAUTH_SUCCESS_ACTION");
toIntent = new Intent(context, CameraList.class);
toIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
EZAccessToken token = MyApplication.getOpenSDK().getEZAccessToken();
context.startActivity(toIntent);
}
}
}
2.解决办法为
1.intent添加flags
toIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
2.manifest 文件里面添加启动模式
<activity android:name="com.video.camera_list.CameraList" android:launchMode="singleTask" />
网友评论