user7174483
user7174483

Reputation: 73

Android Notification stops updating after a certain time

In my App i am using the TimerTask with an Interval of 1s. If the App is in the background, I show the current Time in the NotificationBar. So every second in the onTick() Method I update the silent Notification. But with Android 10 it stops updating after few minutes. All Notifications are blocked, also the other channels.

Is there a new permission or another way to show the Time in the NotificationBar?

Upvotes: 0

Views: 279

Answers (1)

Dipankar Baghel
Dipankar Baghel

Reputation: 2069

your application might be killed in background so that's why it stops showing the updates.

Try using workmanager for your app to run continuously below is the links

workmanager

Key features:

  • Backwards compatible up to API 14
  • Uses JobScheduler on devices with API 23+
  • Uses a combination of BroadcastReceiver + AlarmManager on devices with API 14-22
  • Add work constraints like network availability or charging status
  • Schedule asynchronous one-off or periodic tasks
  • Monitor and manage scheduled tasks
  • Chain tasks together
  • Ensures task execution, even if the app or device restarts
  • Adheres to power-saving features like Doze mode

Upvotes: 2

Related Questions