Android: Scheduled Task With Exact Time & Network Connectivity

Viewed 502

Trying to implement a requirement where a:

  • background task needs to be fired off at exact time scheduled by a user (like an alarm clock),
  • with this task making a network connection and performing sync w/ server
  • requirement calls for minSDK 14 and up.

I'm familiar with available API's for background task scheduling like AlarmManager, JobScheduler, GcmNetworkManager and the new WorkManager -

However all of them fall short and after Oreo API changes it seems very difficult (if not impossible) to achieve this exact requirement.

The issue is:

  • AlarmManager can guarantee exact time scheduling / task execution - but network connectivity will likely be off at that time.
  • JobScheduler / GcmNetworkManager / WorkManager - can fire when network is connected (during maintenance windows), but are designed for deferrable tasks and do not guarantee that the task will run at exact scheduled time.

Need suggestions on approach / strategy on how to achieve exact task scheduling with network connectivity - perhaps chaining multiple API's or using something different.

0 Answers
Related