1

I am trying to build an android app to perform a specific task at particular time everyday. So i have tried to implement it in each and every possible way ie. AlarmManager with Broadcast receiver, Job Scheduler and even WorkManager API's. All the 3 mentioned above works well without any problems only if my app is in the recent apps list, if at all i clear the app from recent apps list, it will never work. I even tried to white List the app by ignoring the battery Optimizations, which again did not give any successful results. But one strange things few apps that i download from play store are working fine without this issue. Any suggestions would be helpful.

My device : One plus 7 (Android O)

Another point is that, I need the app to trigger at night when it may not be connected to a network, so gcm is ruled out for me. So is there any offline solutions !?

Prajwal
  • 11
  • 2
  • 1
    "Any suggestions would be helpful" -- on several manufacturers' devices, clearing the task behaves a bit like "Force Stop" in the Settings screen for the app. Removing scheduled alarms and jobs is part of that. `WorkManager` relies on alarms and jobs. You can try using high-priority Firebase Cloud Messaging messages. – CommonsWare Aug 13 '20 at 22:13
  • But that would require my phone to be connected to a network right !? I just wanted an offline solution ! – Prajwal Aug 13 '20 at 22:26
  • 1
    "But that would require my phone to be connected to a network right !?" -- yes. "I just wanted an offline solution" -- then explain to the user that they should not clear your app's task. Or, redesign your app to not rely on background triggers like these. Doing background work in Android has gotten very annoying over the past five years. – CommonsWare Aug 13 '20 at 22:33

0 Answers0