Computer Science, asked by Harsha19111999, 1 year ago

Android: I have an Activity which has a button. And when the button is clicked, a new intent is created and it is passed to startService() which starts a service. In the onHandleIntent() of the IntentService, it waits for 10 seconds and shows a notification. But if I close the app, the notification doesn't show. Why?

Answers

Answered by sawakkincsem
1
Hi,
What I assumed is that you are doing is that you start notification on button click that intent is pass on start service() after again open app your notification is disappear for this you have to stored session for notification or you have to save the state of notification. On instance save bundle , or in instance state.
you have to use session manager for your notification due to use of session manager its stores the session of notification.Due to this your state is save on application when you again open this. For this you have to follow or keep on store session or session manager in your code.
I hope you understand my point.
Thanks :)
Similar questions