Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. private void shownotification(String message, Context context) {
  2. NotificationManager mNotificationManager = (NotificationManager) context
  3. .getSystemService(context.NOTIFICATION_SERVICE);
  4. NotificationCompat.Builder mNotifyBuilder = new NotificationCompat.Builder(
  5. context).setContentTitle("my app").setContentText(message)
  6. .setDefaults(Notification.DEFAULT_ALL).setAutoCancel(true)
  7. .setSmallIcon(R.drawable.Mypic);
  8. Notification notification = mNotifyBuilder.build();
  9. notification.flags |= Notification.FLAG_AUTO_CANCEL;
  10. mNotificationManager.notify(0, notification);
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement