我们如何才能结束praticular用户的XMPP会话和注销形成聊天 [英] how we can end the session of praticular user in XMPP and logout form the chat
问题描述
按钮退出=(按钮)this.findViewById(R.id.btlogout);
logout.setOnClickListener(新View.OnClickListener(){
Button logout = (Button) this.findViewById(R.id.btlogout); logout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
connection.disconnect();
setContentView(R.layout.login);
}
});
这code是让我退出却不能查杀了会议,并对此我重定向该页面的按钮,页面不能正常工作。
this code is allowing me logout but not killing the session and the page which i am redirecting that page's button is not working .
推荐答案
全部发送presence数据包发送到服务器的第一,那么你就应该注销。这样,你的会话将被杀死。
First of all send presence packet to server and then you should logout. This way your session will be killed.
Presence pr=new Presence(Presence.Type.unavailable);
connection.sendPacket(pr);
connection.disconnect();
它会先下线,然后让你断开连接后从server.Hope它会help.Thanks。
it will first made you offline and then after disconnect from server.Hope it will help.Thanks.
这篇关于我们如何才能结束praticular用户的XMPP会话和注销形成聊天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!