Update the notification at the same frequency as the animation duration.
For example, if the animation duration is 1200 milliseconds,
void update() { createForegroundNotification(); handler.postDelayed(this::update, 1200); }