Flurry Push for Unity iOS¶
Flurry Push enables app developers to send targeted messages to re-engage and retain users. To start using Flurry Push on Unity iOS:
- Integrate the latest Flurry SDK for iOS. To use the features of Flurry Push checkout the push branch.
- Follow the integration steps below
- Provide Flurry your authorization credentials
- Test your integration via test push
Flurry will receive the push notification (from APNs) and convert it to a Flurry Message. The Unity plugin will set a listener to get notify when a push is received and opened. This allows you to handle and customize each event as you wish.
- Setup for receiving push Notifications - Flurry will register with UNUserNotificationCenter (>= iOS 10) or UIUserNotification.
- Notification Received - Flurry will LOG and SHOW the notification if the app is in the background. If the app is in foreground Flurry will LOG but NOT show the notification.
- The Unity plugin includes a delegate method didReceiveMessage that can be modified to customize the app’s behavior in response to receiving the push notification.
- Notification Clicked - Flurry will LOG notification when user clicks on it. By default Flurry would launch the app.
- The Unity plugin includes a delegate method didReceiveActionWithIdentifier that can be modified to customize the app’s behavior in response to the notification click.
- Modifying the delegate methods is optional and not a requirement to use Flurry Push on Unity.
- Enable Push Notifications
- Enable Background Modes (Background Fetch and Remote Notifications turned on)
When pushes are received or tapped, a Flurry background session occurs to allow Flurry to measure push metrics. Flurry exposes a method to allow you to determine whether such sessions are counted in the same way that foreground sessions are counted: withIncludeBackgroundSessionsInMetrics. Make sure to set withIncludeBackgroundSessionsInMetrics according to your app measurement needs.
Setting this method to YES/true:
- Background sessions initiated by push notifications, as well as session data for other background sessions, will be included in overall session metrics. This will impact time spent, uniques and other metrics.
Setting this method to NO/false
- Background sessions including sessions initiated by push notifications will not be included in overall session metrics. Push events such as PushOpened will be reported even if set to NO/false.
- You must set to NO/false to exclude push-initiated background sessions from being counted as sessions for your app.
This is set in the Builder as shown above.
Enabling Push Events on cold start (recommended)¶
When a push notification is received on warm start Flurry will record two events Flurry.PushReceived and Flurry.PushOpened.
On a cold start the Flurry SDk will only capture the Flurry.PushOpened event. However because the instance of FlurryUnityPlugin is not present on a cold start modifying your app’s didFinishLaunchingWithOptions method is required to capture this event. Note this step is optional and is only necessary if you need to capture all Flurry.PushOpened events. Add the following code to didFinishLaunchingWithOptions in UnityAppController.mm:
Was this document helpful?