Android SDK API Reference

From Engineering Client Portal

Revision as of 21:26, 24 May 2017 by Admin (talk | contribs)

Engineering Portal / Digital / Android SDK API Reference
The Nielsen App SDK (located in the com.nielsen.app.sdk package) class is the primary application interface to the Nielsen App SDK on Android.

  • Create and initialize an instance object of AppSdk class.
  • The player application can use this object to collect HLS timed metadata through a sendID3() call.

The Nielsen App SDK class is defined as the only public class belonging to the com.nielsen.app.sdk package. It inherits from the closeable interface and exposes the public APIs the client’s app will use. Below is the declaration of the AppSdk class: public class AppSdk implements Closeable

Android SDK API Methods & Properties

Scenario Method / Property DTVR DAR Digital Audio DCR International (Germany) Description
Initialize AppSDK() Used to create a new instance of the SDK object
Measurement play() Used when there is an ID3 fed product such as DTVR and the client does not want to send in all the CMS metadata that is sent in loadMetadata. This allows the client to send in at least the required “channel name” value associated to the ID3 feed. If this is not called then the “channel name” value populated will be the default value of “defaultChannelName”.
Measurement loadMetadata() Used when there is a preroll ad that needs to be associated with content metadata. The loadmetadata will first be called to populate the content metadata values and then the loadMetadata for ad metadata will be called. This allows sending a content ping with the ad info, even if the user bails out during the preroll ad.
Measurement sendID3() Used to send the ID3 metadata.
Measurement setPlayheadPosition() Used to send the playhead position.
Measurement stop() Used when playback is paused and when switching between ad and content or content and ad.
Measurement end() Used when content playback is complete. This is triggered 1) at the end of the content stream, 2) if the user switches to another piece of content
Measurement updateOTT() Used to notify App SDK that the remote OTT device (like Google ChromeCast, Roku, Amazon FireTV, etc.) is connected / disconnected (change of OTT status).
Opt-out userOptOutURLString() Used to fetch the Nielsen opt-out web page URL.
Opt-out userOptOut() Used to supply the response message from opt-out webpage to the SDK.
Opt-out getOptOutStatus() Call this API to retrieve the Opt-Out or Opt-In state.
Opt-out appDisableApi()

(kill switch)

Used to disable the SDK.
Opt-out getAppDisable() Used to query if the SDK is disabled or not.
Log getLastEvent() Used to query the SDK for the last status
Log getLastError() Used to query the SDK for the last error
Log isValid() Used to check if the SDK was successfully instantiated or not.
Log getMeterVersion() Returns the current SDK version.
Log getNielsenId() Used to get a string defining the Nielsen ID (NUID) number for the device.
Log getDeviceId() Returns the current device id.
Log appInBackground() Used to capture the event of app going to background.
Log appInForeground() Used to capture the event of app coming to foreground
Log setDebug() Used to enable/disable debug flags. Newly introduced in SDK version 5.0.0 for International (Germany)