If playhead is not available from audio / video Measurement, allow the app to start a timer (1-5 seconds) and use the timer event to send playhead position to the SDK. Once the actual playhead is available, let the app send the proper playhead position. This allows the SDK to calculate and provide a closer value for duration.

Buffering state

Do not supply playhead position while the content is being buffered.

If the content is in buffering state continuously for more than 30 seconds, call stop() API.

Ad Content

The playhead positions for ad and content should be maintained separately.

Configure API calls – stop

Call stop() only at the end of ad and when the stream playback is stopped by a user or an interruption from another event. Common events are; network loss, power / standby, incoming call, alarm, etc. Call stop() only when buffering continues for 30 seconds (not when it starts). Call loadMetadata() and setPlayheadPosition() when a previously stopped stream resumes. Call play() when starting playback of a new stream.

loadMetadata() is called. Playhead should be passed for the entire duration of ad pod, if the ad pod details are passed as part of loadMetadata().

The sample API sequence below can be used as a reference to identify the specific events that need to be called during content and ad playback.

Content Type

Sample code

Description

Start of Stream

mAppSdk.play(channelName);

mAppSdk.loadMetadata(contentMetaDataObject);

// channelName contains JSON metadata of channel / video name being played

// contentMetadataObject contains the JSON metadata for the content being played

Preroll

mAppSdk.loadMetadata(prerollMetadataObject);

mAppSdk.setPlayheadPosition(playheadPosition);

mAppSdk.stop();

// prerollMetadataObject contains the JSON metadata for the preroll ad

// playheadPosition is position of the playhead while the preroll ad is being played

// Call stop after preroll occurs

Content

mAppSdk.loadMetadata(contentMetaDataObject);

mAppSdk.setPlayheadPosition(playheadPosition);

mAppSdk.stop();

// contentMetadataObject contains the JSON metadata for the content being played
// playheadPosition is position of the playhead while the content is being played

// Call stop when content is paused (ad starts)

Midroll

mAppSdk.loadMetadata(midrollMetaDataObject);

mAppSdk.setPlayheadPosition(playheadPosition);

mAppSdk.stop();

mAppSdk.loadMetadata(midrollMetaDataObject);

mAppSdk.setPlayheadPosition(playheadPosition);

mAppSdk.stop();

// midrollMetaDataObject contains the JSON metadata for the midroll ad

// playheadPosition is position of the playhead while the midroll ad is being played

// App moves to background(midroll pauses)

// App moves to foreground (midroll resumes)

// playheadPosition is position of the playhead while the midroll ad is being played

// Call stop after midroll ends

Content

mAppSdk.loadMetadata(contentMetaDataObject);

mAppSdk.setPlayheadPosition(playhead position);mAppSdk.stop();

// contentMetaDataObject contains the JSON metadata for the content being played
// playheadPosition is position of the playhead while the content is being played

// Always call stop irrespective of postroll is followed or not

End of Stream

mAppSdk.end();

// Call end at the end of content.

Postroll

mAppSdk.loadMetadata(postrollMetaDataObject);

mAppSdk.setPlayheadPosition(playheadPosition);

mAppSdk.stop();

// postrollMetaDataObject contains the JSON metadata for the postroll ad

// playheadPosition is position of the playhead while the postroll ad is being played

// Call stop if postroll occurs

Handling Foreground and Background states of App

There are two ways of handling the foreground and background states of the client application.

Let App SDK handle the app states information (foreground / background) and use it, as necessary. Click here for more information.

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. Click here for more information.

New devices (Android 4.0 and later versions)

Add application tag to Manifest XML file

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.

XHTML

1

2

3

<application android:name="com.nielsen.app.sdk.AppSdkApplication">

This is the custom Application class where the whole background detection implementation is done.

No new permissions are required to change the properties in Manifest XML file.

Older devices (Android 4.0 or earlier version)

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.

XHTML

1

2

3

4

AppLaunchMeasurementManager.appInForeground(getApplicationContext());

AppLaunchMeasurementManager.appInBackground(getApplicationContext());

Interruptions during playback

As part of integrating Nielsen App SDK with the player application, the Audio / Video app developer needs to handle the following possible interruption scenarios.

Nielsen Measurement Opt-Out Implementation

As a global information and measurement leader, we are committed to protecting the privacy and security of the data we collect, process and use. Our digital measurement products are not used to identify the consumer in any way, but they help us and our clients measure and analyze how consumers engage with media across online, mobile and emerging technologies, and offer insights into consumer behavior.

When the app user wants to opt in or opt out of Nielsen measurement, a new dynamic page (with content string obtained from userOptOutURLString()) should be displayed.