发送远程图片
/**
* 发送远程图片
*
* @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);
}
}
});
}
发送本地语音和发送本地图片一样,传入本地语音的本地路径即可 |