1 /**2 * Send Notifications3 * 4 * @parammessage5 */6@SuppressWarnings ("Deprecation")7@SuppressLint ("Newapi")8 Private voidsendnotification (String message) {9 //intent to execute after clickingTenIntent Intent =NewIntent (Mcontext, mainactivity.class); OnePendingintent pendingintent = pendingintent.getactivity (mcontext, 0, AIntent, 0); -Notification Notification =NewNotification (); -Notification.icon =R.drawable.ic_launcher; theNotification.tickertext = "Notifications"; -Notification.when =System.currenttimemillis (); -Notification.defaults =Notification.default_sound -| Notification.default_vibrate;//set Default to System sound +Notification.flags = Notification.flag_auto_cancel;//automatically disappears after clicking -Notification.setlatesteventinfo (Mcontext, "notifications", message, pendingintent); + ANotificationmanager Mmanager =(Notificationmanager) Getsystemservice (notification_service); atMmanager.notify (1, notification); - -}
Android Send notification bar notification