android扩展openfire注册

使用android注册openfire增加注册字段,要修改服务器端,扩展注册实现,牵扯的类太多,也不麻烦,服务器端改好后,用客户端测试下吧:直接使用asmack可以,客户端使用asmack包扩展一下Registration类中的属性没有达到目的,。方法1、直接使用情况核心代码
System.out.println("----->register");
Registration reg = new Registration();
reg.setType(IQ.Type.SET);
reg.setTo(XmppTool.getConnection().getServiceName()); reg.addAttribute("username",username.getText().toString()); reg.addAttribute("password",password.getText().toString()); reg.addAttribute("email","test@qq.com"); reg.addAttribute("test","test"); reg.addAttribute("android","create");
PacketFilter filter = new AndFilter(new PacketIDFilter(reg
.getPacketID()), new PacketTypeFilter(IQ.class));
PacketCollector collector =XmppTool.getConnection().createPacketCollector(filter);
XmppTool.getConnection().sendPacket(reg);
result = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
System.out.println(result+"resutl............");
方法2、继承Registration类增加get,set方法(失败)
使用 System.out.println("----->register");
RegInfo reg = new RegInfo();
reg.setType(IQ.Type.SET);
reg.setTo(XmppTool.getConnection().getServiceName());
reg.setUsername(username.getText().toString());
reg.setPassword(password.getText().toString());
reg.setEmail("test@qq.com");
reg.setTest("test");
结果服务器端没有可以得到用户名和密码但是email和test得不到结果?
展开阅读全文

没有更多推荐了,返回首页