退出环信登陆重新登陆后没有提示音和震动
我们的用户系统接上环信的,在Application类初始化相关代码用于消息推送,
由于前台的时候不会触发Application类的回调,所以我们自己注册了广播用于监听,一个视频和一个新消息的,
IntentFilter callFilter = new IntentFilter(EMChatManager.getInstance().getIncomingCallBroadcastAction());
IntentFilter callFilter1 = new IntentFilter(EMChatManager.getInstance().getNewMessageBroadcastAction()); registerReceiver(callReceiver, callFilter1); registerReceiver(callReceiver, callFilter);
提醒是有声音和震动的,但是当我执行退出操作调用了
EMChatManager.getInstance().logout(),并且会销毁掉所有的活动跳转到登陆页面,重新登陆完会调用
EMChatManager.getInstance().login()这个方法之后,消息有回调但是没有声音和震动,期间没有涉及操作震动或者提示音代码。不知道为什么会出现这种情况,请教怎么处理。是否是因为Application类的初始化代码的原因
EMChatManager.getInstance().logout()的方法会触发什么事件
这是Application类的初始化代码
String processAppName = getAppName();
// 如果APP启用了远程的service,此application:onCreate会被调用2次
// 为了防止环信SDK被初始化2次,加此判断会保证SDK被初始化1次
// 默认的app会在以包名为默认的process name下运行,如果查到的process name不是APP的process name就立即返回
if (processAppName == null || !processAppName.equalsIgnoreCase("x x x x x x")) {
//"com.easemob.chatuidemo"为demo的包名,换到自己项目中要改成自己包名
// 则此application::onCreate 是被service 调用的,直接返回
return true;
}
EMChat.getInstance().init(this);
//获取到配置options对象
EMChatOptions options = EMChatManager.getInstance().getChatOptions();
//设置自定义的文字提示
options.setNotifyText(new OnMessageNotifyListener() {
@Override
public String onNewMessageNotify(EMMessage message) {
return "";
}
@Override
public String onLatestMessageNotify(EMMessage message, int fromUsersNum, int messageNum) {
return getNotifyText(message);
}
@Override
public String onSetNotificationTitle(EMMessage emMessage) {
return "xxxxxxxx";
}
@Override
public int onSetSmallIcon(EMMessage emMessage) {
return R.mipmap.ic_launcher;
}
});
options.setOnNotificationClickListener(message -> new Intent(context, MainActivity.class).setFlags(FLAG_UPDATE_CURRENT));
/**
* debugMode == true 时为打开,SDK会在log里输入调试信息
* @param debugMode
* 在做代码混淆的时候需要设置成false
*/
EMChat.getInstance().setDebugMode(false);//在做打包混淆时,要关闭debug模式,避免消耗不必要的资源
EMChat.getInstance().setAppInited();
EMChat.getInstance().setAutoLogin(true);
由于前台的时候不会触发Application类的回调,所以我们自己注册了广播用于监听,一个视频和一个新消息的,
IntentFilter callFilter = new IntentFilter(EMChatManager.getInstance().getIncomingCallBroadcastAction());
IntentFilter callFilter1 = new IntentFilter(EMChatManager.getInstance().getNewMessageBroadcastAction()); registerReceiver(callReceiver, callFilter1); registerReceiver(callReceiver, callFilter);
提醒是有声音和震动的,但是当我执行退出操作调用了
EMChatManager.getInstance().logout(),并且会销毁掉所有的活动跳转到登陆页面,重新登陆完会调用
EMChatManager.getInstance().login()这个方法之后,消息有回调但是没有声音和震动,期间没有涉及操作震动或者提示音代码。不知道为什么会出现这种情况,请教怎么处理。是否是因为Application类的初始化代码的原因
EMChatManager.getInstance().logout()的方法会触发什么事件
没有找到相关结果
已邀请:
1 个回复
geri_yang