标题:
详解MChatManager(2)
[打印本页]
作者:
look_w
时间:
2019-4-12 15:30
标题:
详解MChatManager(2)
发送远程图片
/**
* 发送远程图片
*
* @param messageManager
* @param url
*/
public void sendRemoteImageMessage(BmobIMConversation messageManager, String url) {
BmobIMImageMessage msg = new BmobIMImageMessage();
msg.setRemoteUrl(url);
messageManager.sendMessage(msg, new MessageSendListener() {
@Override
public void done(BmobIMMessage bmobIMMessage, BmobException e) {
if (mMessageListener != null) {
mMessageListener.onSendMessage(bmobIMMessage, Message.TYPE_IMAGE, e);
}
}
});
}
发送远程图片传入的参数也是有两个,第一个和发送本地图片一样,其实发送消息都需要使用BmobIMConversation的实例去发送,第二个参数是远程图片的url地址
发送本地语音
/**
* 发送本地语音
*
* @param messageManager
* @param path
*/
public void sendLocalAudioMessage(BmobIMConversation messageManager, String path) {
BmobIMAudioMessage msg = new BmobIMAudioMessage(path);
messageManager.sendMessage(msg, new MessageSendListener() {
@Override
public void done(BmobIMMessage bmobIMMessage, BmobException e) {
if (mMessageListener != null) {
mMessageListener.onSendMessage(bmobIMMessage, Message.TYPE_AUDIO, e);
}
}
});
}
发送本地语音和发送本地图片一样,传入本地语音的本地路径即可
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/)
Powered by Discuz! 7.0.0