How to send a messag to multiple recipients in (a)Smack?

孤人 提交于 2019-12-11 23:13:30

问题


I am wondering if there is a way to set multiple targets for a message instead of sending message to multiple targets separately?

 for(i = 0; i<x ; i++){

Message msg = new Message("reza@myhostMessage.Type.chat);
   msg.setBody("HEY");
    try {
        connection.sendPacket(msg);
    } catch (NotConnectedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
  }
}

回答1:


Simply use MultiRecipientManager.send(XMPPConnection connection, Packet packet, List<String> to, List<String> cc, List<String> bcc)



来源:https://stackoverflow.com/questions/25503960/how-to-send-a-messag-to-multiple-recipients-in-asmack

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!