سؤال

So I want to start a notification only when x Activity onStop() is called. But I want to have a loop that updates the notification every second (countdown)

As you can imagine, I want to cancel the notification on the Activity onResume() or on the autocancel for the notification.

As a general Android question, is the only way to do this is with a Service? Open to any and all suggestions.

هل كانت مفيدة؟

المحلول

Yes, Wes. Since the Activity itself is in onStop(), you need something outside the Activity to do a continuing action (the countdown). A Service is the usual way to accomplish that.

Peter

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top