/**
* handle the new message
* this function can be override
*
* @param message
*/
public synchronized void onNewMsg(EMMessage message) {
if(EaseCommonUtils.isSilentMessage(message)){
return;
}
EaseSettingsProvider settingsProvider = EaseUI.getInstance().getSettingsProvider();
if(!settingsProvider.isMsgNotifyAllowed(message)){
return;
}
// check if app running background 不检查,不管在不在后台运行都要通知栏
sendNotification(message, false);
// if (!EasyUtils.isAppRunningForeground(appContext)) {
// EMLog.d(TAG, "app is running in backgroud");
// sendNotification(message, false);
// } else {
// sendNotification(message, true);
//
// }
6 个回复
H-Mo/怠惰
在需要通知栏通知的地方调用这个:
onNewMsg(EMMessage message) 和 onNewMesg(List<EMMessage> messages) 就是上面我让你改的两个方法.根据需要调用其中一个方法就可以了.
在哪里调用?
聊天消息监听器中,群组消息监听器中,,,,,以及任何一个你需要通知栏通知的地方.
比如:在EMMessageListener的onMessageReceived方法中,调用onNewMesg,就可以实现收到聊天消息就进行通知栏通知了.
[已注销]
[已注销]
http://docs.easemob.com/start/200androidcleintintegration/135easeuiuseguide#设置通知栏内容提供者_不设置则使用默认的
H-Mo/怠惰
如果,楼主想要不管在不在后台都显示到通知栏的话,可以这么做:
1.打开这个文件 com.hyphenate.easeui.model.EaseNotifier.java
2.修改114ha行到159行的两个方法,修改成这样:
----------------------------------------------------------------------------------------------------------------------
其实,很简单,就是吧检查APP是否在后台运行的代码注释掉而已.
注意:我是在 3.3.1 版本下这么做的,其他版本,需要修改的代码不一定在这个行数.
[已注销]
kevinhe - 萌新程序猿