In my android project I need to show the notification when the certain event has occurred.
In my application, I have a service which starts at boot completion. And this Service starts the background threads. These threads raises the event.
Now the requirement is, when the event occurred , i want to show the notification in the middle of the screen.this notification is similar to the dialog box with single button. The notification screen exist until the user clicked on the button,means when the user clicked on the button,the screen will disappear.I don’t know how the create the notification in the middle of the screen.
Any help will be appreciated..
A Service can’t create UI, so you’ll need to create an Activity that contains the UI you want, and send an Intent from the Service to the Activity.
Update:
I really recommend that you start from the fundamentals to understand everything that’s going on here, but basically you need to:
For #1, you have two obvious options that I can think of, either of which should work:
For #2, this is basic Android: