Applozic sdk,无法以编程方式创建新组
Applozic sdk, unable to create new group programmatically
createChannel方法returns使用applozic sdk实现群聊时为空,android.
List<String> channelMembersList = new ArrayList<String>();
channelMembersList.add(p.getMobile());
channelMembersList.add("9567600846");
channelMembersList.add("8089117582");
final ChannelInfo channelInfo = new ChannelInfo("GroupName",channelMembersList);
channelInfo.setType(Channel.GroupType.PRIVATE.getValue().intValue());
runOnUiThread(new Runnable() {
@Override
public void run() {
channel = ChannelService.getInstance(WelcomeActivity.this).createChannel(channelInfo);
}
});
这里,尽管 ChannelInfo 对象为 created.Someone,但通道对象始终为 null,请帮忙...
正在使用 applozic
创建组
创建具有特定群组类型的群组
Channel.GroupType.PRIVATE.getValue().intValue()
Public group with type : Channel.GroupType.PUBLIC.getValue().intValue()
Open group with type : Channel.GroupType.OPEN.getValue().intValue()
注意:组元数据是可选的
设置消息的群组元数据,如创建群组、离开群组、从群组中移除、群组删除、群组图标更改和群组名称更改。
注意:如果频道元数据设置为空字符串,则不会向group/channel中的其他用户发送通知。
ChannelMetadata channelMetadata = new ChannelMetadata();
channelMetadata.setCreateGroupMessage(ChannelMetadata.ADMIN_NAME + " created " + ChannelMetadata.GROUP_NAME);
channelMetadata.setAddMemberMessage(ChannelMetadata.ADMIN_NAME + " added " + ChannelMetadata.USER_NAME);
channelMetadata.setRemoveMemberMessage(ChannelMetadata.ADMIN_NAME + " removed " + ChannelMetadata.USER_NAME);
channelMetadata.setGroupNameChangeMessage(ChannelMetadata.USER_NAME + " changed group name " + ChannelMetadata.GROUP_NAME);
channelMetadata.setJoinMemberMessage(ChannelMetadata.USER_NAME + " joined");
channelMetadata.setGroupLeftMessage(ChannelMetadata.USER_NAME + " left group " + ChannelMetadata.GROUP_NAME);
channelMetadata.setGroupIconChangeMessage(ChannelMetadata.USER_NAME + " changed icon");
channelMetadata.setDeletedGroupMessage(ChannelMetadata.ADMIN_NAME + " deleted group " + ChannelMetadata.GROUP_NAME);
以下占位符将被替换
ChannelMetadata.ADMIN_NAME : admin name of the group
ChannelMetadata.USER_NAME : user name of the user
ChannelMetadata.GROUP_NAME : group name
我们添加了一个异步任务,您可以使用此异步任务创建一个 group/channel 传递组成员、组名等详细信息,一些详细信息是可选的。
更新:
AlChannelCreateAsyncTask.TaskListenerInterface channelCreateTaskListener = new AlChannelCreateAsyncTask.TaskListenerInterface() {
@Override
public void onSuccess(Channel channel, Context context) {
Log.i("Group","Group response :"+channel);
}
@Override
public void onFailure(ChannelFeedApiResponse channelFeedApiResponse, Context context) {
}
};
List<String> groupMembersUserIdList = new ArrayList<>();
groupMembersUserIdList.add("user1");
groupMembersUserIdList.add("user2");
groupMembersUserIdList.add("user3");//Note:while creating group exclude logged in userId from list
ChannelInfo channelInfo = new ChannelInfo("Group name",groupMembersUserIdList);
channelInfo.setType(Channel.GroupType.PUBLIC.getValue().intValue()); //group type
channelInfo.setImageUrl(""); //pass group image link URL
//channelInfo.setChannelMetadata(channelMetadata); //Optional option for setting group meta data
//channelInfo.setClientGroupId(clientGroupId); //Optional if you have your own groupId then you can pass here
AlChannelCreateAsyncTask channelCreateAsyncTask = new AlChannelCreateAsyncTask(context,channelInfo,channelCreateTaskListener);
channelCreateAsyncTask.execute();
5.34版本中
ChannelService.getInstance(WelcomeActivity.this).createChannel(channelInfo)
分配 AlResponse
的变量。
并且AlResponse
在ChannelService.getInstance(WelcomeActivity.this).createChannel(channelInfo)
之后为空
createChannel方法returns使用applozic sdk实现群聊时为空,android.
List<String> channelMembersList = new ArrayList<String>();
channelMembersList.add(p.getMobile());
channelMembersList.add("9567600846");
channelMembersList.add("8089117582");
final ChannelInfo channelInfo = new ChannelInfo("GroupName",channelMembersList);
channelInfo.setType(Channel.GroupType.PRIVATE.getValue().intValue());
runOnUiThread(new Runnable() {
@Override
public void run() {
channel = ChannelService.getInstance(WelcomeActivity.this).createChannel(channelInfo);
}
});
这里,尽管 ChannelInfo 对象为 created.Someone,但通道对象始终为 null,请帮忙...
正在使用 applozic
创建组创建具有特定群组类型的群组
Channel.GroupType.PRIVATE.getValue().intValue()
Public group with type : Channel.GroupType.PUBLIC.getValue().intValue()
Open group with type : Channel.GroupType.OPEN.getValue().intValue()
注意:组元数据是可选的
设置消息的群组元数据,如创建群组、离开群组、从群组中移除、群组删除、群组图标更改和群组名称更改。
注意:如果频道元数据设置为空字符串,则不会向group/channel中的其他用户发送通知。
ChannelMetadata channelMetadata = new ChannelMetadata();
channelMetadata.setCreateGroupMessage(ChannelMetadata.ADMIN_NAME + " created " + ChannelMetadata.GROUP_NAME);
channelMetadata.setAddMemberMessage(ChannelMetadata.ADMIN_NAME + " added " + ChannelMetadata.USER_NAME);
channelMetadata.setRemoveMemberMessage(ChannelMetadata.ADMIN_NAME + " removed " + ChannelMetadata.USER_NAME);
channelMetadata.setGroupNameChangeMessage(ChannelMetadata.USER_NAME + " changed group name " + ChannelMetadata.GROUP_NAME);
channelMetadata.setJoinMemberMessage(ChannelMetadata.USER_NAME + " joined");
channelMetadata.setGroupLeftMessage(ChannelMetadata.USER_NAME + " left group " + ChannelMetadata.GROUP_NAME);
channelMetadata.setGroupIconChangeMessage(ChannelMetadata.USER_NAME + " changed icon");
channelMetadata.setDeletedGroupMessage(ChannelMetadata.ADMIN_NAME + " deleted group " + ChannelMetadata.GROUP_NAME);
以下占位符将被替换
ChannelMetadata.ADMIN_NAME : admin name of the group
ChannelMetadata.USER_NAME : user name of the user
ChannelMetadata.GROUP_NAME : group name
我们添加了一个异步任务,您可以使用此异步任务创建一个 group/channel 传递组成员、组名等详细信息,一些详细信息是可选的。
更新:
AlChannelCreateAsyncTask.TaskListenerInterface channelCreateTaskListener = new AlChannelCreateAsyncTask.TaskListenerInterface() {
@Override
public void onSuccess(Channel channel, Context context) {
Log.i("Group","Group response :"+channel);
}
@Override
public void onFailure(ChannelFeedApiResponse channelFeedApiResponse, Context context) {
}
};
List<String> groupMembersUserIdList = new ArrayList<>();
groupMembersUserIdList.add("user1");
groupMembersUserIdList.add("user2");
groupMembersUserIdList.add("user3");//Note:while creating group exclude logged in userId from list
ChannelInfo channelInfo = new ChannelInfo("Group name",groupMembersUserIdList);
channelInfo.setType(Channel.GroupType.PUBLIC.getValue().intValue()); //group type
channelInfo.setImageUrl(""); //pass group image link URL
//channelInfo.setChannelMetadata(channelMetadata); //Optional option for setting group meta data
//channelInfo.setClientGroupId(clientGroupId); //Optional if you have your own groupId then you can pass here
AlChannelCreateAsyncTask channelCreateAsyncTask = new AlChannelCreateAsyncTask(context,channelInfo,channelCreateTaskListener);
channelCreateAsyncTask.execute();
5.34版本中
ChannelService.getInstance(WelcomeActivity.this).createChannel(channelInfo)
分配 AlResponse
的变量。
并且AlResponse
在ChannelService.getInstance(WelcomeActivity.this).createChannel(channelInfo)