以下是自定义的类,IntercomStartMessageContent,调用ChatManager.sendMessage发送该自定义信息,发送失败回调onFailure函数,errorCode码为-1,这个是什么问题导致的?-1代表什么
@ContentTag(type = MessageContentType.ContentType_Call_Intercom_Start, flag = PersistFlag.Persist)
public class IntercomStartMessageContent extends MediaMessageContent {
private String indexPath;
public IntercomStartMessageContent() {
this.mediaType = MessageContentMediaType.INTERCOM;
}
public IntercomStartMessageContent(String audioPath) {
this.indexPath = audioPath;
this.mediaType = MessageContentMediaType.INTERCOM;
}
public String getIndexPath() {
return indexPath;
}
public void setIndexPath(String indexPath) {
this.indexPath = indexPath;
}
@Override
public MessagePayload encode() {
MessagePayload payload = super.encode();
payload.searchableContent = "[语音]";
try {
JSONObject objWrite = new JSONObject();
objWrite.put("indexPath", indexPath);
payload.content = objWrite.toString();
} catch (JSONException e) {
e.printStackTrace();
}
return payload;
}
@Override
public void decode(MessagePayload payload) {
super.decode(payload);
try {
if (payload.content != null) {
JSONObject jsonObject = new JSONObject(payload.content);
// duration = jsonObject.optInt("duration");
indexPath = jsonObject.optString("indexPath");
}
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public String digest(Message message) {
return "[语音]";
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags);
dest.writeString(this.indexPath);
}
protected IntercomStartMessageContent(Parcel in) {
super(in);
this.indexPath = in.readString();
}
public static final Creator<IntercomStartMessageContent> CREATOR = new Creator<IntercomStartMessageContent>() {
@Override
public IntercomStartMessageContent createFromParcel(Parcel source) {
return new IntercomStartMessageContent(source);
}
@Override
public IntercomStartMessageContent[] newArray(int size) {
return new IntercomStartMessageContent[size];
}
};
}