我怎样才能在安卓系统中改变我的Gtalk或Gmail的状态?[英] How can i change the status of my Gtalk or Gmail in Android?

本文是小编为大家收集整理的关于我怎样才能在安卓系统中改变我的Gtalk或Gmail的状态?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

使用我的应用程序,我想改变我的Gmail或Gtalk的状态.我怎么改变它? 是否有任何示例代码?

提前感谢.

推荐答案

如果您使用 Smack API for Android:

// Create the presence object with default availability 
Presence presence = new Presence(Presence.Type.available);

// Set the status message
presence.setStatus("Lame status is lame");

// Set the highest priority
presence.setPriority(24);

// Set available presence mode
presence.setMode(Presence.Mode.available);

// Send the presence packet through the connection
connection.sendPacket(presence);

本文地址:https://www.itbaoku.cn/post/102371.html

问题描述

Using my application, i want to change the status of my gmail or gtalk. How can i change it? Is there any sample code??

Thanks in advance.

推荐答案

If you are using Smack API for Android :

// Create the presence object with default availability 
Presence presence = new Presence(Presence.Type.available);

// Set the status message
presence.setStatus("Lame status is lame");

// Set the highest priority
presence.setPriority(24);

// Set available presence mode
presence.setMode(Presence.Mode.available);

// Send the presence packet through the connection
connection.sendPacket(presence);