Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. Intent intent = new Intent(context, LiveFeedScreen.class);
  2. intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
  3. intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
  4. final int not_nu = generateRandom();
  5. PendingIntent pendingIntent = PendingIntent.getActivity(context,
  6. not_nu, intent, PendingIntent.FLAG_ONE_SHOT);
  7. NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(
  8. context)
  9. .setSmallIcon(R.drawable.notificationbig_icon)
  10. .setColor(context.getResources().getColor(R.color.header_blue))
  11. .setContentTitle(context.getString(R.string.app_name))
  12. .setContentText(mMessage)
  13. .setAutoCancel(true)
  14. .setStyle(
  15. new NotificationCompat.BigTextStyle().bigText(mMessage))
  16. .setContentIntent(pendingIntent);
  17. NotificationManager notificationManager = (NotificationManager) context
  18. .getSystemService(Context.NOTIFICATION_SERVICE);
  19.  
  20. notificationManager.notify(not_nu, notificationBuilder.build());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement