0

We need to add functionality in Android app (Api 26+) that every X hours (doesn't have to be precise) will fire some task which will read local database and then display Notification (by click on Notification some Activity should be shown).

Problem is, this should happen no matter if app is in background or not. I've been reading about Android lifecycle and limitations put on recent android versions and I was wondering what would be best solution, using WorkManager or AlarmManager then scheduling job?

Is it even possible to run Activity on Notification tap, when app has been killed or is in background and not whitelisted?

Areage
  • 3
  • 1

1 Answers1

0

First Question:

WorkManager is the best solution for this. Behind the scene, workmanager is also using job scheduler ,job dispatchers, GCM Network Manager,Alarm Manager and Broadcast receivers, depending upon the operating system with handling of backward compatibilities.

It has alot of functions which will make its implementation clean and easy.Also we don't need to restart it after device reboot like service, it will start itself.

Second Question:

Yes, we can open application by taping on notification even if app is killed. You can check this.

Muhammad Zahab
  • 1,049
  • 10
  • 21