Guest User

Untitled

a guest
Mar 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. Intent scheduledIntent = new Intent(context,Activity.class);
  2.  
  3. PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, scheduledIntent, 0);
  4.  
  5. nm = (NotificationManager) context
  6. .getSystemService(Context.NOTIFICATION_SERVICE);
  7. CharSequence from = "From address";
  8. CharSequence message = "New Orders received";
  9. Notification notif = new Notification(R.drawable.icon,"Hai", System.currentTimeMillis());
  10. notif.setLatestEventInfo(context, from, message, pendingIntent);
  11. notif.flags |= Notification.FLAG_AUTO_CANCEL;
  12. nm.notify(uniqueID, notif);
  13. notif.ledOnMS = 500;
  14. notif.ledOffMS = 500;
  15.  
  16. AppPreferences prefs = new AppPreferences(PresentChatActivity.this);
  17. boolean notify_checkbox = prefs.getNotifyState();
  18.  
  19. Notification(message.getBody(),fromName, name);
  20.  
  21. protected void Notification(String body, String fromName, String Notificationmsg) {
  22.  
  23. NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
  24.  
  25. String tickerText = getString(R.string.app_name, body);
  26. Notification notif = new Notification(R.drawable.ic_launcher, tickerText,
  27. System.currentTimeMillis());
  28.  
  29. Intent notificationIntent = new Intent(this, PresentChatActivity.class);
  30. PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
  31.  
  32.  
  33. notif.setLatestEventInfo(PresentChatActivity.this,Notificationmsg, message, pendingIntent);
  34. notif.setLatestEventInfo(getApplicationContext(), fromName, body,pendingIntent );
  35. notificationManager.notify(10001, notif);
  36. }
Add Comment
Please, Sign In to add comment