Advertisement
Guest User

Untitled

a guest
Sep 18th, 2014
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. @Override
  2. protected void onMessage(Context context, Intent intent) {
  3. Log.d(TAG, "onMessage - context: " + context);
  4.  
  5. // Extract the payload from the message
  6. Bundle extras = intent.getExtras();
  7. if (extras != null)
  8. {
  9. // if we are in the foreground, just surface the payload, else post it to the statusbar
  10. if (PushPlugin.isInForeground()) {
  11. extras.putBoolean("foreground", true);
  12. PushPlugin.sendExtras(extras);
  13. }
  14. else {
  15. extras.putBoolean("foreground", false);
  16.  
  17. // Send a notification if there is a message ORIGINAL HERE
  18. if (extras.getString("message") != null && extras.getString("message").length() != 0) { /// this is the line i edidted
  19. createNotification(context, extras);
  20. }
  21. }
  22. }
  23. }
  24.  
  25. // Send a notification if there is a message ORIGINAL HERE
  26. if (extras.getString("message").length() != 0) {
  27. createNotification(context, extras);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement