本文整理汇总了Java中com.netease.nimlib.sdk.msg.model.CustomNotificationConfig类的典型用法代码示例。如果您正苦于以下问题:Java CustomNotificationConfig类的具体用法?Java CustomNotificationConfig怎么用?Java CustomNotificationConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CustomNotificationConfig类属于com.netease.nimlib.sdk.msg.model包,在下文中一共展示了CustomNotificationConfig类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateRoomSuccess
import com.netease.nimlib.sdk.msg.model.CustomNotificationConfig; //导入依赖的package包/类
private void onCreateRoomSuccess(String roomName, List<String> accounts) {
String teamID = transaction.getTeamID();
// 在群里发送tip消息
IMMessage message = MessageBuilder.createTipMessage(teamID, SessionTypeEnum.Team);
CustomMessageConfig tipConfig = new CustomMessageConfig();
tipConfig.enableHistory = false;
tipConfig.enableRoaming = false;
tipConfig.enablePush = false;
String teamNick = TeamDataCache.getInstance().getDisplayNameWithoutMe(teamID, DemoCache.getAccount());
message.setContent(teamNick + getActivity().getString(R.string.t_avchat_start));
message.setConfig(tipConfig);
sendMessage(message);
// 对各个成员发送点对点自定义通知
String teamName = TeamDataCache.getInstance().getTeamName(transaction.getTeamID());
String content = TeamAVChatHelper.sharedInstance().buildContent(roomName, teamID, accounts, teamName);
CustomNotificationConfig config = new CustomNotificationConfig();
config.enablePush = true;
config.enablePushNick = false;
config.enableUnreadCount = true;
for (String account : accounts) {
CustomNotification command = new CustomNotification();
command.setSessionId(account);
command.setSessionType(SessionTypeEnum.P2P);
command.setConfig(config);
command.setContent(content);
command.setApnsText(teamNick + getActivity().getString(R.string.t_avchat_push_content));
command.setSendToOnlineUserOnly(false);
NIMClient.getService(MsgService.class).sendCustomNotification(command);
}
}
示例2: sendTypingCommand
import com.netease.nimlib.sdk.msg.model.CustomNotificationConfig; //导入依赖的package包/类
/**
* 发送“正在输入”通知
*/
private void sendTypingCommand() {
if (container.account.equals(NimUIKit.getAccount())) {
return;
}
if (container.sessionType == SessionTypeEnum.Team || container.sessionType == SessionTypeEnum.ChatRoom) {
return;
}
if (System.currentTimeMillis() - typingTime > 5000L) {
typingTime = System.currentTimeMillis();
CustomNotification command = new CustomNotification();
command.setSessionId(container.account);
command.setSessionType(container.sessionType);
CustomNotificationConfig config = new CustomNotificationConfig();
config.enablePush = false;
config.enableUnreadCount = false;
command.setConfig(config);
JSONObject json = new JSONObject();
json.put("id", "1");
command.setContent(json.toString());
NIMClient.getService(MsgService.class).sendCustomNotification(command);
}
}