【问题标题】:sinch instant message writable add extra fieldsinch 即时消息可写添加额外字段
【发布时间】:2016-09-20 00:17:56
【问题描述】:

嗨,如何向可写字段添加额外的字段以将其他内容传递给数据映射,例如,我希望能够传递图像的 url 从而允许图像共享,如何进行,主要是 js 开发,所以不是真的如何实现添加新功能以工作 sinch 服务器

public final class WritableMessage {
private static final int HEADER_MAX_SIZE = 1024;
private final String messageId;
private String textBody;
private string extraContent;// added here for passing img url
private List<String> recipientIds;
private Map<String, String> headers;
private int headerSize;

public WritableMessage(String recipientUserId, String textBody, extraContent) {
    this();
    this.addExtra(extraContent); // but the sinch doesnt allow overide
    this.addRecipient(recipientUserId);
    this.setTextBody(textBody);
}

【问题讨论】:

    标签: sinch android-sinch-api


    【解决方案1】:

    使用 addHeader 为您的消息添加额外的内容

    public WritableMessage(String recipientUserId, String textBody, string imageUrl) {
        this();
        this.addHeader("imageUrl", imageUrl); 
        this.addRecipient(recipientUserId);
        this.setTextBody(textBody);
    }
    

    【讨论】:

    • 应该扩展它的消息还是有更好的方法来做到这一点
    猜你喜欢
    • 2010-11-12
    • 1970-01-01
    • 1970-01-01
    • 2015-08-26
    • 1970-01-01
    • 2011-12-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-19
    相关资源
    最近更新 更多