Interface BundleAndDeferCallback
-
public interface BundleAndDeferCallback
This callback is used to get the current value of the period in which Smack does bundle and defer outgoing stanzas.Smack will bundle and defer stanzas if the connection is authenticated and if a bundle and defer callback is set, either via
XMPPTCPConnection.setDefaultBundleAndDeferCallback(BundleAndDeferCallback)
orXMPPTCPConnection.setBundleandDeferCallback(BundleAndDeferCallback)
, andgetBundleAndDeferMillis(BundleAndDefer)
returns a positive value. In a mobile environment, bundling and deferring outgoing stanzas may reduce battery consumption. It heavily depends on the environment, but recommend values for the bundle and defer period range from 20-60 seconds. But keep in mind that longer periods decrease the realtime aspect of Smack.Smack will invoke the callback when it needs to know the length of the bundle and defer period. If
getBundleAndDeferMillis(BundleAndDefer)
returns 0 or a negative value, then the stanzas will send immediately. You can also prematurely abort the bundling of stanzas by callingBundleAndDefer.stopCurrentBundleAndDefer()
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
getBundleAndDeferMillis(BundleAndDefer bundleAndDefer)
Return the bundle and defer period used by Smack in milliseconds.
-
-
-
Method Detail
-
getBundleAndDeferMillis
int getBundleAndDeferMillis(BundleAndDefer bundleAndDefer)
Return the bundle and defer period used by Smack in milliseconds.- Parameters:
bundleAndDefer
- used to premature abort bundle and defer.- Returns:
- the bundle and defer period in milliseconds.
-
-