Difference between revisions of "DCR Italy Static App SDK"

From Engineering Client Portal

Line 79: Line 79:
 
|}
 
|}
  
== Handling Foreground and Background states for Android Devices ==
+
== Handling Foreground and Background states ==
There are two ways of handling the foreground and background states of the client application.
+
For iOS, background/foreground detection is handled by the app lifecylce APIs which are provided by [https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/TheAppLifeCycle/TheAppLifeCycle.html Apple]:
=== For Android 4.0 and later ===
 
Let App SDK handle the app states information (foreground / background) and use it, as necessary.  
 
  
'''Add ''application'' tag to Manifest XML file'''
+
For Android devices,  Nielsen has has made available the [[Android_Background_Foreground|SdkBgFgDetectionUtility class]] for detection of the Foreground/Background state.
When client’s app supports only new devices (Android 4.0 and above) and the client has not implemented a custom Application class for some other purpose,
 
* Add the following entry (application tag) into the Manifest XML file to use SDK’s state detection feature.
 
<syntaxhighlight lang="java">    <application android:name="com.nielsen.app.sdk.AppSdkApplication"></syntaxhighlight>
 
This is the custom Application class where the whole background detection implementation is done.
 
<blockquote>Note: No new permissions are required to change the properties in Manifest XML file.</blockquote>
 
  
=== For Android 4.0 or earlier ===
+
Correct measurement of the foreground/background state is crucial to Static App measurement within Nielsen Digital Content Ratings (DCR).
* Capture app states through the application and trigger the corresponding API ([[appInForeground()]] or [[appInBackground()]]) upon every change of state. This allows Nielsen App SDK to know the app state.
 
 
 
Identify the change of state through the application and call the respective API ([[appInForeground()]] or [[appInBackground()]]) upon every change of state (foreground / background). The SDK will use this information to pass the app launch times, etc. to Collection facility.
 
<syntaxhighlight lang="java">    AppLaunchMeasurementManager.appInForeground(getApplicationContext());
 
    AppLaunchMeasurementManager.appInBackground(getApplicationContext());</syntaxhighlight>
 
  
 
== Privacy and Opt-Out ==
 
== Privacy and Opt-Out ==
 
Please follow the steps outlined in the [[DCR Italy Video App SDK]] documentation.
 
Please follow the steps outlined in the [[DCR Italy Video App SDK]] documentation.

Revision as of 00:53, 8 November 2017

Engineering Portal breadcrumbArrow.png Digital breadcrumbArrow.png International breadcrumbArrow.png DCR Italy Static App SDK

Overview

The Nielsen SDK is one of multiple framework SDKs that Nielsen provides to enable measuring linear (live) and on-demand TV viewing using TVs, mobile devices, etc. The App SDK is the framework for mobile application developers to integrate Nielsen Measurement into their media player applications. It supports a variety of Nielsen Measurement Products like Digital in TV Ratings, Digital Content Ratings (DCR & DTVR), Digital Ad Ratings (DAR), Digital Audio. Nielsen SDKs are also equipped to measure static content and can track key life cycle events of an application like:

  • Application launch events and how long app was running
  • Time of viewing a sub section / page in the application.

Implementation

This guide covers implementation steps for iOS using Xcode and Java using Android Studio to enable STATIC MEASUREMENT within you APP.

Prerequisites

To start using the Nielsen App SDK, your Xcode or Android Studio environments need to have specific Frameworks or Classes included in your project/app. This information is detailed in the DCR Italy Video App SDK documentation.

The remainder of this document will assume that you have followed the steps outlined in the DCR Italy Video App SDK documentation to Initialize the Nielsen SDK.

Initialize the SDK

Specific steps are outlined in the DCR Italy Video App SDK documentation.

Populate and Pass Metadata Object

The Nielsen SDK is able to monitor Application launch events and how long your app has been running. Once the Nielsen SDK has been Initialized, pass "type":'static' as a JSON object via loadMetadata.

Swift

        let staticMetadata = [
            "type": "static",
            "section": "siteSection",
            "segA":"CustomSegmentValueA", //Optional
            "segB":"CustomSegmentValueB", //Optional
            "segC":"CustomSegmentValueC" //Optional
        ];
         self.nielsenAppApi?.loadMetadata(staticMetadata)

Objective C

 
   NSDictionary *staticMetadata = @
    {
        "type": "static",
        "section": "siteSection",
        "segA":"CustomSegmentValueA", //Optional
        "segB":"CustomSegmentValueB", //Optional
        "segC":"CustomSegmentValueC" //Optional
    }
 (void)loadMetadata:(id)staticMetadata;

Java

    JSONObject staticMetadata = new JSONObject()
        .put("type", "static")
        .put("section", "siteSection")
        .put("assetid", "vid345-67483")
        .put("segA", "segmentA") //Optional
        .put("segB", "segmentB") //Optional
        .put("segC","segmentC") //Optional
    }
public void loadMetadata(JSONObject staticMetadata);

The above code would be repeated for each change in "section" within your app.

Nielsen SDK Metadata

The following table defines the staticMetadata reserved keys:

Key Description Data Type Value Required?
type asset type fixed 'static' Yes
assetid Unique ID for each article dynamic custom Yes
section section of each site (e.g. section value should be first level in page URL: website.com/section). Limit to 25 unique values dynamic custom Yes
segA custom segment for reporting: dynamic custom No
segB custom segment for reporting: dynamic custom No
segC custom segment for reporting: fixed custom No

Handling Foreground and Background states

For iOS, background/foreground detection is handled by the app lifecylce APIs which are provided by Apple:

For Android devices, Nielsen has has made available the SdkBgFgDetectionUtility class for detection of the Foreground/Background state.

Correct measurement of the foreground/background state is crucial to Static App measurement within Nielsen Digital Content Ratings (DCR).

Privacy and Opt-Out

Please follow the steps outlined in the DCR Italy Video App SDK documentation.