解决方案 »

  1.   

    没想到也有这么多人在用asmack功能啊
      

  2.   

    我也在搞,也是接受的文件是空的...还有经常点接受就报错..  使用smack不能和spark互发文件!~
      

  3.   

    插件包有问题:可以下载这个!http://download.csdn.net/detail/longfei36/5927427
      

  4.   

    发送端:
     public void sendMessage(final String to,final String from,final String body)
       {
       new Thread(){
       public void run() {
       try {
       
       Message msg=new Message();
       msg.setTo(to+"@"+ApplicationData.instance.xmppServerName);
       msg.setFrom(from+"@"+ApplicationData.instance.xmppServerName);
       msg.setBody(body);
       msg.setType(Type.chat);
       //发给服务器加密
       Message msgServer=new Message();
       msgServer.setTo(to+"@"+ApplicationData.instance.xmppServerName);
       msgServer.setFrom(from+"@"+ApplicationData.instance.xmppServerName);
      byte[] data=body.getBytes();
      for (int i=0;i<data.length;i++)
      {
      data[i]=Tools.enCrypt(data[i]);
      }
      String newBody=new String(data);
       msgServer.setBody(newBody);
       msgServer.setType(Type.chat);
       ApplicationData.instance.xmppConnection.sendPacket(msgServer);
       
       String strTo=to+"@"+ApplicationData.instance.xmppServerName;
       PrivateChatMessageEntity.addMessage(strTo, msg);
       //发广播
       Intent intent=new Intent(ApplicationData.ACTION_SHOW_MESSAGE);
       ApplicationData.instance.sendBroadcast(intent);