Joke Collection Website - Public benefit messages - Help on how to globally monitor Android broadcasts

Help on how to globally monitor Android broadcasts

This is the code in onCreate

//Register to receive new messages to listen for broadcast

msgReceiver = new NewMessageBroadcastReceiver();

IntentFilter intentFilter = new IntentFilter(EMChatManager

.getInstance().getNewMessageBroadcastAction());

intentFilter.setPriority(3);

registerReceiver(msgReceiver, intentFilter );

The following are the operations in the broadcast written by myself

private class NewMessageBroadcastReceiver extends BroadcastReceiver {

@Override

public void onReceive (Context context, Intent intent) {

//Abort broadcast

abortBroadcast();

//Message id (each message will generate a unique one id, currently generated by SDK)

String msgId = intent.getStringExtra("msgid");

EMMessage message = EMChatManager.getInstance().getMessage(msgId);

String news = ((TextMessageBody) message.getBody()).getMessage();

//Sender id

String userId = intent.getStringExtra("from ");

username = userId;

Info info = new Info();

info.setText(news);

info.setId(msgId);

info.setUserid(userId);

list.add(info);

}

}