Advertisement
Guest User

Untitled

a guest
Jul 14th, 2014
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. NOTIFICATION_ID ++;
  2. mNotificationManager = (NotificationManager)
  3. this.getSystemService(Context.NOTIFICATION_SERVICE);
  4. NotificationCompat.Builder mBuilder =
  5. new NotificationCompat.Builder(this)
  6. .setSmallIcon(R.drawable.ic_launcher)
  7. .setContentTitle(msg.getString("title"))
  8. .setContentText(msg.getString("message"))
  9. .setDefaults(Notification.DEFAULT_SOUND)
  10. .setStyle(new NotificationCompat.BigPictureStyle().bigPicture(Picasso.with(getApplicationContext()).load(msg.getString("icon")).get()).setSummaryText(msg.getString("message")))
  11. .setAutoCancel(true);
  12.  
  13. Log.e("msg---",msg.toString());
  14. Intent intent = new Intent(Intent.ACTION_MAIN);
  15. intent.setComponent(new ComponentName(this, ActivityDetail.class));
  16. // intent.setAction(Intent.ACTION_MAIN);
  17. intent.addCategory(Intent.CATEGORY_LAUNCHER);
  18. // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
  19. intent.putExtra(Keys._PostId,msg.getString("id"));
  20. intent.putExtra(Keys._Image, msg.getString("icon"));
  21. intent.putExtra(Keys._PostType, msg.getString("post_type"));
  22. PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, 0);
  23.  
  24. mBuilder.setContentIntent(contentIntent);
  25. mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement