Skip to main content

Add a Moment. Text, text and images, text and video, and images and video combinations are supported.

API Reference

/**
* publish a Moments post
* @param content text content of the Moments post
* @param mediaList list of media in the Moments post (images or videos)
* @param callback result callback
*/
void addMoment(String content, List<MomentMedia> mediaList, JIMConst.IResultCallback<Moment> callback);

Code Example

MomentMedia media1 = new MomentMedia();
media1.setType(MomentMedia.MomentMediaType.IMAGE);
media1.setUrl("www.baidu.com");
MomentMedia media2 = new MomentMedia();
media2.setType(MomentMedia.MomentMediaType.VIDEO);
media2.setUrl("www.google.com");
List<MomentMedia> l = new ArrayList<>();
l.add(media1);
l.add(media2);
JIM.getInstance().getMomentManager().addMoment("Beautiful!", l, new JIMConst.IResultCallback<Moment>() {
@Override
public void onSuccess(Moment moment) {
}

@Override
public void onError(int errorCode) {
}
});