Home>
private void shownotification () {
//create a reference to notificationmanager
notificationmanager notificationmanager=(notificationmanager)
autofile.this.getsystemservice (android.content.context.notification_service);
//Define various properties of notification
notification notification=new notification (r.drawable.dvd, "Tianzhizhi Player", system.currenttimemillis ());
notification.flags |=notification.flag_ongoing_event;//Place this notification in the "ongoing" or "running" group of the notification bar
notification.flags |=notification.flag_no_clear;//indicates that after clicking "clear notification" in the notification bar, this notification is not cleared,Often used with flag_ongoing_event
notification.flags |=notification.flag_show_lights;
notification.defaults=notification.default_lights;
notification.ledargb=color.blue;
notification.ledonms=5000;
//Set notification event message
charsequence contenttitle="The sound of nature sounds playing ...";//notification bar title
charsequence contenttext="ameyume";//notification bar content
intent notificationintent=new intent (autofile.this, myplayerservice.class);//activity to jump to after clicking the notification
pendingintent contentitent=pendingintent.getactivity (autofile.this, 0, notificationintent, 0);
notification.setlatesteventinfo (autofile.this, contenttitle, contenttext, contentitent);
//pass notification to notificationmanager
notificationmanager.notify (0, notification);
}
To delete the icon,With the following code:
//delete the notification we defined before the startup
notificationmanager notificationmanager=(notificationmanager) this
.getsystemservice (notification_service);
notificationmanager.cancel (0);
Trends
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- python - you may need to restart the kernel to use updated packages error
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- python 3x - typeerror: 'method' object is not subscriptable
- javascript - how to check if an element exists in puppeteer
- xcode - pod install [!] no `podfile 'found in the project directory
- i want to call a child component method from a parent in vuejs
- vuejs - [vuetify] unable to locate target [data-app] i want to unit test to avoid warning