Prevent the phone from sleeping. This is likely not in the xmpp code but in the app permissions.
If the phone starts saving energy it may turn off WiFi and data, so one may want to control/listen to these settings/state changes.
Anyhow an Android forum may produce better answers. Maybe with 4.x there are better down-/upload features.