Flurry Push for iOS¶
Flurry Push enables app developers to send targeted messages to re-engage and retain users. To start using Flurry Push on iOS:
Integrate the latest Flurry SDK for iOS
If using Cocoapods, include “pod ‘Flurry-iOS-SDK/FlurryMessaging’” in your podfile
Follow the integration steps below
Provide Flurry your authorization credentials
Test your integration via test push
Enable Push Notifications
Enable Background Modes (Background Fetch and Remote Notifications turned on)
Include header file
If using Objective-C, include FlurryMessaging.h.
if using Swift, no action is required.
import Flurry_iOS_SDKincludes messaging header file.
Auto Integration - With Auto Integration, Flurry handles everything for you. All you have to do is to call the integration API
[FlurryMessaging setAutoIntegrationForMessaging]. We’ll receive the notification, convert it to a FlurryMessage, show the notification, handle the notification click, handle the dismissed notification, and handle all the Flurry logging associated with it. Want some customized functionality? You have the option of passing us a delegate to handle any of these steps yourself.
Manual Integration - With Manual Integration, your app is responsible for handling the notification receivers and logging events like “Opened” to Flurry. Flurry will check if a notification is sent from Flurry Protal or not. If so, Flurry has
receivedNotificationResponsethree methods to help you organize what to do when a remote Flurry notification is arrived.
If you are integrating Flurry Push alongside one or more other push providers, we recommend using manual instead of auto integration
Flurry will receive the push notification (from APNs) and convert it to a Flurry Message. You may optionally set a listener to get notified 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. Also, setup the delegate to receive the below notifications
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.
Flurry will also return a callback , if the delegate is set.
Notification Clicked - Flurry will LOG notification when user clicks on it. By default Flurry would launch the app.
Flurry will also return a callback , if the delegate is set. This would be the place to use the deeplink to load the appropriate View.
In your AppDelegate class, place the following code in application:willFinishLaunchingWithOptions:
Registration & Setup
Implement the Delegate method for Received
Implement the Delegate method for Clicked
Manual integration helps you handle it all. Flurry provides a few helper methods for you to determine if a notification is from Flurry, and if so, convert the notification into a FlurryMessage. In manual integration, you must log the following events as described:
Set token - If you receive a callback that the token has been set, provide Flurry with the token via the setDeviceToken: api.
Notification Received - When a notification from Flurry is received log it to Flurry via
Notification Clicked - When a notification from Flurry is clicked, log this event to Flurry via the receivedNotificationResponse:withCompletionHandler: api.
In your AppDelegate class, implement as follows:
Setup and Registration
Set the device token
Log Notification Received & Clicked
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:
FlurrySessionBuilder* builder = [[[FlurrySessionBuilder alloc] withIncludeBackgroundSessionsInMetrics:NO];
[Flurry startSession:@”API_KEY” withOptions:launchOptions withSessionBuilder:builder];