I use a com.firebase.jobdispatcher.JobService
to sync data, I start it by scheduling a Job
using FirebaseJobDispatcher
.
Problem: I don't like the delay before it runs on my very first app start.
Is there a way in which I can start the service, on Android O, as a foreground service (with a notification) the first time I use it? (instead of scheduling it as a job)
I tried:
ContextCompat.startForegroundService(context, intent);
but this does not call the onCreate of the JobService
.
Conclusion: use two services.
A com.firebase.jobdispatcher.JobService
cannot be started in the foreground.
A normal Service
cannot be started as a scheduled Job
.
I created two service classes that both start the same sync-flow: fixed.