Created
October 19, 2018 22:22
-
-
Save flurrydev/f179c7f6731fe2253b17c97ea87248bb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public boolean onNotificationClicked(FlurryMessage flurryMessage) { | |
| // NOTE: THIS METHOD WILL ONLY BE CALLED IF FLURRY HANDLED onNotificationReceived callback | |
| // determine if you'd like to handle the clicked notification yourself or not | |
| boolean handled = false; | |
| // see if notification contains deeplink | |
| if (flurryMessage.getAppData() != null && flurryMessage.getAppData().containsKey("deeplink")) { | |
| String deeplink = flurryMessage.getAppData().get("deeplink"); | |
| // create the Intent | |
| final Intent deeplinkIntent = new Intent(Intent.ACTION_VIEW); | |
| deeplinkIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
| deeplinkIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); | |
| // set the data using your deeplink | |
| deeplinkIntent.setData(Uri.parse(deeplink)); | |
| // add the FlurryMessage to extras | |
| FlurryMessaging.addFlurryMessageToIntentExtras(deeplinkIntent, flurryMessage); | |
| // make sure the deeplink resolves to an activity, then open it | |
| if (deeplinkIntent.resolveActivity(context.getPackageManager()) != null) { | |
| context.startActivity(deeplinkIntent); | |
| // tell flurry you've handled the notification | |
| handled = true; | |
| } | |
| } | |
| return handled; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment