I have just finished writing a basic chat app and is working fine, thanks to Smack library (and developers for sure). Now I have requirement where user can opt in settings to keep the app running even after closing the main app.
Seems we are left with Workmanager or Foreground services. Would like to hear recommendation on what is the new normal on this one since we still have apps powered by Smack
In my limited experience the only suitable solution is a sticky foreground service.
On devices with newer Android users can disable the sticky notification if you make use of Notification Channels.
mtangoo,
The Android and IOS devices will eventually Suspend the application running in backgroud for Battery Optimization. Push Notification from Google FCM and Apple notification center will wake up the application if required.
XMPP server having device Data like “DeviceToken” will tell Google FCM which will then tell the Device OS to wake up the suspended app, and ready to receive and talk with XMPP server.
Smack Developers may have implemented these feature.
XMPP server like Openfire have recently released the Push notification plugin which may work with smack library.