Created
October 19, 2018 01:52
-
-
Save flurrydev/a4a7d88af171c93673cd1dd175f93104 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
| /\* | |
| \* This method will only be called whenever a Flurry notification is received, regardless of | |
| \* whether app is in foreground or in background. To determine app | |
| \* state, you can either track it yourself or call FlurryMessaging.isAppInForeground | |
| \*/ | |
| @Override | |
| public void onMessageReceived(RemoteMessage remoteMessage) { | |
| // determine if push is from Flurry | |
| if (FlurryMessaging.isFlurryMessage(remoteMessage)) { | |
| //retrieve flurry message | |
| FlurryMessage flurryMessage = FlurryMessaging.convertFcmMessageToFlurryMessage(remoteMessage); | |
| // log flurry message received event | |
| FlurryMessaging.logNotificationReceived(flurryMessage); | |
| if (FlurryMessaging.isAppInForeground()) { | |
| // handle notification knowing app is in foreground | |
| } else { | |
| // handle notification knowing app is in background | |
| } | |
| /\*\* | |
| \* IMPORTANT: | |
| \* When creating a notification, you may use the Flurry helper method FlurryMessaging.showNotification() | |
| \* or create your own. If you use the Flurry helper method, Flurry will automatically | |
| \* log the click and dismissed notification events. In the event that the notification is clicked, | |
| \* Flurry will launch the launcher or "click_action" activity with the Intent.FLAG_ACTIVITY_NEW_TASK flag. | |
| \* If you choose to create your own notification, be sure to call FlurryMessaging.logNotificationClicked and | |
| \* FlurryMessaging.logNotificationCancelled as the respective events occur. | |
| \* | |
| \* FlurryMessage is a Parcelable object and can be passed as an extra through intents. | |
| \* Flurry provides helper methods to do so. | |
| \* See - FlurryMessaging.addFlurryMessageToIntentExtras and FlurryMessaging.getFlurryMessageFromIntent | |
| \*/ | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment