You can achieve it using foreground. A foreground service performs some operation that is noticeable to the user. Foreground services continue running even when the user isn't interacting with the app.
What's app must be using Foreground Service and continue its operation. You can follow this SO for implementation details of such service.
In order to sync the state, you need to maintain the state data required in your ForegroundService. You can start an activity when the ForegroundService's notification is clicked. When activity is created you can bind to service to get the current state and then implement LocalBroadcastReceiver for future updates.