Integrate Flurry SDK for tvOS

Integrating the Flurry tvOS SDK for tvOS apps with is easy and straightforward. Support is provided for both native and client-server apps.

Using Flurry Analytics for tvOS, you can measure app performance with standard Flurry Analytics metrics, as well as Sessions and Active Devices metrics in real time.

Prerequisites: Xcode 13 and above.

Follow these instructions to get started.

Create an App & Get Your API Keys

Start by creating a new tvOS app. Once you create the app, you’ll receive a Flurry API Key, which you’ll need for SDK instrumentation.

Important

You need to have the administrator role on your company’s account to be able to create a new app within the company.

Sign up  or  Create an App for tvOS

Note

For each distinct tvOS app that you create, you’ll need to acquire a unique Flurry API Key.

Import Flurry Libraries

The easiest way to add the Flurry SDK to your app is via CocoaPods. If you’re not familiar with CocoaPods you can refer to their detailed documentation here.

Install CocoaPods tool on OS X by running the following command:

$ sudo gem install cocoapods

1 Navigate to your Xcode project’s directory and create a Podfile by typing: $ pod init

2 Open the Podfile and add your dependencies.

#. platform :tvos, '10.0'
#. pod 'Flurry-iOS-SDK/FlurryTVOS' #tVOS Analytics Pod

3 Run the $ pod install command in the directory containing the Podfile.

Find more details about how to add the SDK to your app in our documentation

Initialize Flurry

To finish integrating Flurry, you’ll need to import Flurry in your Application Delegate and start a Flurry session inside applicationDidFinishLaunching, as described for Objective-C and Swift.

For Objective-C:

#import "Flurry.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Replace YOUR_API_KEY with the api key in the downloaded package
[Flurry startSession:@"YOUR_API_KEY"];
}

For Swift:

import "Flurry_iOS_SDK"
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Replace YOUR_API_KEY with the api key in the downloaded package
Flurry.startSession("YOUR_API_KEY")
return true
}

Additionally for client-server apps

Note that this step is only necessary if you app is a client-server app.

Client-server apps require the Application Delegate to conform to TVApplicationControllerDelegate.

Inside theappController:evaluageAppJavaScriptInContext of TVApplicationControllerDelegate you need to register theJSContext with the FlurryTVOS SDK, shown as follows for Objective-C or Swift:

For Objective-C:

(void)appController:(TVApplicationController *)appController evaluateAppJavaScriptInContext:(JSContext *)jsContext {
  [Flurry registerJSContextWithContext:jsContext];
}

For Swift:

func appController(appController: TVApplicationController, evaluateAppJavaScriptInContext jsContext: JSContext) {

Flurry.registerJSContextWithContext(jsContext)

}

This additional step for client-server apps makes JavaScript methods globally available to the JavaScript domain.

Now test run your tvOS app and ensure that it builds without errors. If everything is working properly, a session will be recorded in Flurry and should be visible on your Real Time dashboard within 30 seconds.

Important

If you created the Flurry app within the last 5 minutes, the app may not yet be live on our servers and thus will not reflect real-time data. Re-run your app after 5 minutes to see your session recorded on the Real Time dashboard.

Congratulations! Your tvOS app is now ready to be used with Flurry Analytics.

Moving On To Custom Events

Now that you’ve completed the basic SDK integration setup, you’re ready to move on to custom events, which enable you to better understand user behavior through Custom Events.

Need Help?

Check out our robust collection of FAQs and a detailed Lexicon of key terminology. Didn’t find what you were looking for. Didn’t find what you were looking for? Contact support@flurry.com for additional support.