Android Periodic work even with app killed

108 Views Asked by At

I would like to start my foreground service every 30 minutes to synchornize data with server.

What I have in mind
Setup a periodic task that just starts my foreground synchronization service.

What I have tried so far

  1. Broadcast Receiver with android.net.conn.CONNECTIVITY_CHANGE. This was my first approach. Try to synchronize data only if device lost connection sometime and recovered it later on. This doesn't work anymore for newer android versions. When app is killed, this broadcast receiver stop working.

  2. AlarmManager

  3. AndroidX.Work.Worker

  4. JobService

All what I tried stop working after app killed. So my question is the following. Is there a way of achieving what I'm aming for in android 10 or above?

0

There are 0 best solutions below