How can i change the status of my Gtalk or Gmail in Android?

后端 未结 1 393
忘掉有多难
忘掉有多难 2021-01-07 07:19

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.

1条回答
  •  北海茫月
    2021-01-07 07:54

    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);
    

    0 讨论(0)
提交回复
热议问题