Guest User

Untitled

a guest
Oct 20th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. @Override
  2.  
  3. public boolean onNotificationClicked(FlurryMessage flurryMessage) {
  4.  
  5. // NOTE: THIS METHOD WILL ONLY BE CALLED IF FLURRY HANDLED onNotificationReceived callback
  6.  
  7. // determine if you'd like to handle the clicked notification yourself or not
  8.  
  9. boolean handled = false;
  10.  
  11. // see if notification contains deeplink
  12.  
  13. if (flurryMessage.getAppData() != null && flurryMessage.getAppData().containsKey("deeplink")) {
  14.  
  15. String deeplink = flurryMessage.getAppData().get("deeplink");
  16.  
  17. // create the Intent
  18.  
  19. final Intent deeplinkIntent = new Intent(Intent.ACTION_VIEW);
  20.  
  21. deeplinkIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  22.  
  23. deeplinkIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  24.  
  25. // set the data using your deeplink
  26.  
  27. deeplinkIntent.setData(Uri.parse(deeplink));
  28.  
  29. // add the FlurryMessage to extras
  30.  
  31. FlurryMessaging.addFlurryMessageToIntentExtras(deeplinkIntent, flurryMessage);
  32.  
  33. // make sure the deeplink resolves to an activity, then open it
  34.  
  35. if (deeplinkIntent.resolveActivity(context.getPackageManager()) != null) {
  36.  
  37. context.startActivity(deeplinkIntent);
  38.  
  39. // tell flurry you've handled the notification
  40.  
  41. handled = true;
  42.  
  43. }
  44.  
  45. }
  46.  
  47. return handled;
  48.  
  49. }
Add Comment
Please, Sign In to add comment