当前位置: 首页>>代码示例>>Java>>正文


Java EMNotifierEvent类代码示例

本文整理汇总了Java中com.easemob.EMNotifierEvent的典型用法代码示例。如果您正苦于以下问题:Java EMNotifierEvent类的具体用法?Java EMNotifierEvent怎么用?Java EMNotifierEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EMNotifierEvent类属于com.easemob包,在下文中一共展示了EMNotifierEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerEaseMobEventListener

import com.easemob.EMNotifierEvent; //导入依赖的package包/类
/**
 * 全局事件监听
 * 这里是拿来获取用户资料和未读计数的
 */
protected void registerEaseMobEventListener() {

    EMChatManager.getInstance().registerEventListener(new EMEventListener() {
        @Override
        public void onEvent(EMNotifierEvent event) {
            final EMMessage msg = (EMMessage) event.getData();
            if (event.getEvent() == EMNotifierEvent.Event.EventNewMessage) {

                //未在聊天的任何界面就计数
                if (!EaseUI.getInstance().hasForegroundActivies()) {
                    PrefService.getInstance(mContext).increatUnread();
                    Log.d(TAG, "new Msg Count");
                }

                //更新联系人
                asyncContact(msg);

                //广播通知,主界面拿来更新的
                Intent broadcastIntent = new Intent(MsgReceiver.NEW_MSG_BROADCAST);
                mContext.sendBroadcast(broadcastIntent, null);
            }
        }
    });
}
 
开发者ID:huijimuhe,项目名称:monolog-android,代码行数:29,代码来源:EaseMobService.java

示例2: onResume

import com.easemob.EMNotifierEvent; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    if(isMessageListInited){
        messageList.refresh();
    }
    EaseUI.getInstance().pushActivity(getActivity());
    // register the event listener when enter the foreground
    EMChatManager.getInstance().registerEventListener(
            this,
            new EMNotifierEvent.Event[] { EMNotifierEvent.Event.EventNewMessage,
                    EMNotifierEvent.Event.EventOfflineMessage, 
                    EMNotifierEvent.Event.EventDeliveryAck,
                    EMNotifierEvent.Event.EventReadAck,
                    EMNotifierEvent.Event.EventNewCMDMessage});
}
 
开发者ID:easemob,项目名称:easeui,代码行数:17,代码来源:EaseChatFragment.java

示例3: onResume

import com.easemob.EMNotifierEvent; //导入依赖的package包/类
@Override
	public void onResume() {
	    Log.i("ChatActivity", "onResume");
		super.onResume();
//		if(group != null)
//			((TextView) findViewById(R.id.name)).setText(group.getGroupName());
		adapter.refresh();

		DemoHXSDKHelper sdkHelper = (DemoHXSDKHelper) DemoHXSDKHelper.getInstance();
        sdkHelper.pushActivity(this);
		// register the event listener when enter the foreground
        EMChatManager.getInstance().registerEventListener(
				this,new EMNotifierEvent.Event[]{EMNotifierEvent.Event.EventNewMessage
						,EMNotifierEvent.Event.EventDeliveryAck
						,EMNotifierEvent.Event.EventReadAck});
	}
 
开发者ID:Owater,项目名称:school_shop,代码行数:17,代码来源:ChatActivity.java

示例4: onResume

import com.easemob.EMNotifierEvent; //导入依赖的package包/类
@Override
protected void onResume() {
	super.onResume();
	if (group != null)
		((TextView) findViewById(R.id.name)).setText(group.getGroupName());
	voiceCallBtn.setEnabled(true);
	videoCallBtn.setEnabled(true);

	 if(adapter != null){
	     adapter.refresh();
     }

	DemoHXSDKHelper sdkHelper = (DemoHXSDKHelper) DemoHXSDKHelper.getInstance();
	sdkHelper.pushActivity(this);
	// register the event listener when enter the foreground
	EMChatManager.getInstance().registerEventListener(
			this,
			new EMNotifierEvent.Event[] { EMNotifierEvent.Event.EventNewMessage,EMNotifierEvent.Event.EventOfflineMessage,
					EMNotifierEvent.Event.EventDeliveryAck, EMNotifierEvent.Event.EventReadAck });
}
 
开发者ID:chenjunqian,项目名称:here,代码行数:21,代码来源:ChatActivity.java

示例5: onResume

import com.easemob.EMNotifierEvent; //导入依赖的package包/类
@Override
protected void onResume() {
	super.onResume();
	if (!isConflict && !isCurrentAccountRemoved) {
		updateUnreadLabel();
		updateUnreadAddressLable();
		EMChatManager.getInstance().activityResumed();
	}

	// unregister this event listener when this activity enters the
	// background
	DemoHXSDKHelper sdkHelper = (DemoHXSDKHelper) DemoHXSDKHelper.getInstance();
	sdkHelper.pushActivity(this);

	// register the event listener when enter the foreground
	EMChatManager.getInstance().registerEventListener(this,
			new EMNotifierEvent.Event[]{EMNotifierEvent.Event.EventNewMessage, EMNotifierEvent.Event.EventOfflineMessage, EMNotifierEvent.Event.EventConversationListChanged});
}
 
开发者ID:chenjunqian,项目名称:here,代码行数:19,代码来源:EMChatMainActivity.java

示例6: onEvent

import com.easemob.EMNotifierEvent; //导入依赖的package包/类
@Override
public void onEvent(EMNotifierEvent emNotifierEvent) {
    switch (emNotifierEvent.getEvent()) {
        case EventNewMessage: // 普通消息
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    if (menuLeftFragment!=null){
                        menuLeftFragment.setItemBackground(View.VISIBLE);
                    }
                }
            });

            LogUtil.e("MainActivity", "EventNewMessage !!!!!!!!!!!!!!!!!");
            break;
    }
}
 
开发者ID:chenjunqian,项目名称:here,代码行数:18,代码来源:MainActivity.java

示例7: onEvent

import com.easemob.EMNotifierEvent; //导入依赖的package包/类
@Override
public void onEvent(EMNotifierEvent emNotifierEvent) {
    switch (emNotifierEvent.getEvent()) {
        case EventNewMessage: // 普通消息
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    handler.sendEmptyMessage(new Message().what = HAS_CHAT_MESSAGE);
                    SharePreferencesUtil.saveEMChatNewMessegeStatus(true);
                }
            });

            LogUtil.e("MainActivity", "EventNewMessage !!!!!!!!!!!!!!!!!");
            break;
    }
}
 
开发者ID:chenjunqian,项目名称:here,代码行数:17,代码来源:MainActivity.java

示例8: onResume

import com.easemob.EMNotifierEvent; //导入依赖的package包/类
@Override
protected void onResume() {
    super.onResume();

    if (!isConflict && !isCurrentAccountRemoved) {
        updateUnreadLabel();
        updateUnreadAddressLable();
    }

    // unregister this event listener when this activity enters the
    // background
    DemoHelper sdkHelper = DemoHelper.getInstance();
    sdkHelper.pushActivity(this);

    // register the event listener when enter the foreground
    EMChatManager.getInstance().registerEventListener(this,
            new EMNotifierEvent.Event[]{EMNotifierEvent.Event.EventNewMessage, EMNotifierEvent.Event.EventOfflineMessage, EMNotifierEvent.Event.EventConversationListChanged});
}
 
开发者ID:nggirl,项目名称:EaseChatDemo,代码行数:19,代码来源:MainActivity.java

示例9: onResume

import com.easemob.EMNotifierEvent; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    if(isMessageListInited)
        messageList.refresh();
    EaseUI.getInstance().pushActivity(getActivity());
    // register the event listener when enter the foreground
    EMChatManager.getInstance().registerEventListener(
            this,
            new EMNotifierEvent.Event[] { EMNotifierEvent.Event.EventNewMessage,
                    EMNotifierEvent.Event.EventOfflineMessage, EMNotifierEvent.Event.EventDeliveryAck,
                    EMNotifierEvent.Event.EventReadAck });
}
 
开发者ID:huijimuhe,项目名称:monolog-android,代码行数:14,代码来源:EaseChatFragment.java

示例10: onResume

import com.easemob.EMNotifierEvent; //导入依赖的package包/类
@Override
protected void onResume() {
	super.onResume();
	
	if (!isConflict && !isCurrentAccountRemoved) {
		updateUnreadLabel();
		updateUnreadAddressLable();
	}

	// unregister this event listener when this activity enters the
	// background
	DemoHelper sdkHelper = DemoHelper.getInstance();
	sdkHelper.pushActivity(this);

	// register the event listener when enter the foreground
	EMChatManager.getInstance().registerEventListener(this,
			new EMNotifierEvent.Event[] { 
					EMNotifierEvent.Event.EventNewMessage,
					EMNotifierEvent.Event.EventOfflineMessage, 
					EMNotifierEvent.Event.EventConversationListChanged,
					EMNotifierEvent.Event.EventNewCMDMessage,
					EMNotifierEvent.Event.EventReadAck
					});
	
	// if push service available, connect will be disconnected after app in background
	// after activity restore to foreground, reconnect 
	if (!EMChatManager.getInstance().isConnected() && NetUtils.hasNetwork(this)) {
	    EMChatManager.getInstance().reconnect();
	}
}
 
开发者ID:easemob,项目名称:sdkdemoapp3.0_android,代码行数:31,代码来源:MainActivity.java

示例11: onEvent

import com.easemob.EMNotifierEvent; //导入依赖的package包/类
/**
	 * 监听事件
     */
	@Override
	public void onEvent(EMNotifierEvent event) {
		switch (event.getEvent()) {
		case EventNewMessage: // 普通消息
		{
//			EMMessage message = (EMMessage) event.getData();

			// 提示新消息
//			HXSDKHelper.getInstance().getNotifier().onNewMsg(message);
			refreshUI();
			break;
		}

		case EventOfflineMessage: {
			refreshUI();
			break;
		}

		case EventConversationListChanged: {
		    refreshUI();
		    break;
		}
		
		default:
			break;
		}
	}
 
开发者ID:chenjunqian,项目名称:here,代码行数:31,代码来源:EMChatMainActivity.java

示例12: onResume

import com.easemob.EMNotifierEvent; //导入依赖的package包/类
@Override
protected void onResume() {
    super.onResume();
    // register the event listener when enter the foreground
    EMChatManager.getInstance().registerEventListener(this,
            new EMNotifierEvent.Event[]{EMNotifierEvent.Event.EventNewMessage});
}
 
开发者ID:chenjunqian,项目名称:here,代码行数:8,代码来源:MainActivity.java

示例13: onEvent

import com.easemob.EMNotifierEvent; //导入依赖的package包/类
/**
 * 监听事件
 */
@Override
public void onEvent(EMNotifierEvent event) {
    switch (event.getEvent()) {
        case EventNewMessage: // 普通消息
        {
            EMMessage message = (EMMessage) event.getData();

            // 提示新消息
            DemoHelper.getInstance().getNotifier().onNewMsg(message);

            refreshUIWithMessage();
            break;
        }

        case EventOfflineMessage: {
            refreshUIWithMessage();
            break;
        }

        case EventConversationListChanged: {
            refreshUIWithMessage();
            break;
        }

        default:
            break;
    }
}
 
开发者ID:nggirl,项目名称:EaseChatDemo,代码行数:32,代码来源:MainActivity.java

示例14: onResume

import com.easemob.EMNotifierEvent; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    if (isMessageListInited)
        messageList.refresh();
    EaseUI.getInstance().pushActivity(getActivity());
    // register the event listener when enter the foreground
    EMChatManager.getInstance().registerEventListener(
            this,
            new EMNotifierEvent.Event[]{EMNotifierEvent.Event.EventNewMessage,
                    EMNotifierEvent.Event.EventOfflineMessage, EMNotifierEvent.Event.EventDeliveryAck,
                    EMNotifierEvent.Event.EventReadAck});
}
 
开发者ID:nggirl,项目名称:EaseChatDemo,代码行数:14,代码来源:EaseChatFragment.java

示例15: onEvent

import com.easemob.EMNotifierEvent; //导入依赖的package包/类
/**
 * 事件监听,registerEventListener后的回调事件
 * 
 * see {@link EMNotifierEvent}
 */
@Override
public void onEvent(EMNotifierEvent event) {
    switch (event.getEvent()) {
    case EventNewMessage:
        // 获取到message
        EMMessage message = (EMMessage) event.getData();

        String username = null;
        // 群组消息
        if (message.getChatType() == ChatType.GroupChat || message.getChatType() == ChatType.ChatRoom) {
            username = message.getTo();
        } else {
            // 单聊消息
            username = message.getFrom();
        }

        // 如果是当前会话的消息,刷新聊天页面
        if (username.equals(toChatUsername)) {
            messageList.refreshSelectLast();
            // 声音和震动提示有新消息
            EaseUI.getInstance().getNotifier().viberateAndPlayTone(message);
        } else {
            // 如果消息不是和当前聊天ID的消息
            EaseUI.getInstance().getNotifier().onNewMsg(message);
        }

        break;
    case EventDeliveryAck:
    case EventReadAck:
        // 获取到message
        messageList.refresh();
        break;
    case EventOfflineMessage:
        // a list of offline messages
        // List<EMMessage> offlineMessages = (List<EMMessage>)
        // event.getData();
        messageList.refresh();
        break;
    default:
        break;
    }

}
 
开发者ID:huijimuhe,项目名称:monolog-android,代码行数:49,代码来源:EaseChatFragment.java


注:本文中的com.easemob.EMNotifierEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。