How to configure Push mode configuration in XMPP w

2019-02-25 07:32发布

问题:

Currently i'm using smack library for XMPP configuration and I want to do XMPP connection of Ejabberd to firebase by send RefreshToken to XMPP.

I need to close connection when application is in background or kill and receive notification from Firebase but how can i send refresh token and other param as below using smack library?

At the start of each session the user must register to a push mechanism. Depending on the chosen mechanism, several parameters can be passed. The push configuration packet could be something like:

<iq type='set' id='123'>
 <push xmlns='p1:push'>
 <keepalive max="30"/>
 <session duration="60"/>
 <body send="all" groupchat="true" from="jid"/>
 <status type="xa">Text Message when in push mode</status>
 <offline>false</offline>
 <notification>
 <type>applepush</type>
 <id>DeviceToken</id>
 </notification>
 <appid>application1</appid>
 </push>
</iq>

How can i configured XMPP connection using smack library.