Integrating with Nielsen on Android

Integrate Nielsen functionality into your Ooyala Android applications.

With the Ooyala Nielsen Plugin for Android, you can add Nielsen functionality to your Ooyala Android applications. Ooyala provides:

  • the Ooyala Android Nielsen Software Development Kit, which includes the JAR file and the API reference documentation
  • a sample application (NielsenSampleAppActivity), which shows how to initialize a Nielsen-enabled player and allow the user to opt out of Nielsen tracking


  • You must have a registered account with Nielsen.
  • You will need your account ID.
  • You must obtain the Nielsen libraries from Nielsen, add them to your development environment, and link to them according to Nielsen's instructions.


Add Nielsen Integration to Your Android Application

The Ooyala Nielsen integration sample (NielsenSampleApp) shows the basics for providing Nielsen integration in your Android app. This section focuses on significant code snippets in the sample app that apply to Nielsen integration.
In addition to the standard imports, NielsenDefaultPlayerActivity begins by importing the following packages:

Next, the sample app initializes s_nielsenAnalytics as an instance of the NielsenAnalytics class, which serves as the bridge to the Nielsen App SDK.

private static NielsenAnalytics s_nielsenAnalytics;
The sample app then initializes arguments that it will later pass to the Nielsen App SDK.
private final static String NIELSEN_SFCODE = "<sfcode-provided-by-Nielsen>";
private final static String NIELSEN_APPID = "<appid-provided-by-Nielsen>";
Argument Description
appID Nielsen-assigned unique id for your application.
sfCode Nielsen collection facility to which the SDK should connect. Nielsen typically assigns different codes for test and production.
Next, the sample application creates a new, standard player.
OoyalaPlayerLayout playerLayout = (OoyalaPlayerLayout) findViewById(;
player = new OoyalaPlayer(PCODE, new PlayerDomain(DOMAIN));
playerLayoutController = new OoyalaPlayerLayoutController(playerLayout, player);
The sample app then enables VisualOn integration, which is required for Nielsen integration. For details, see About VisualOn Integrations.
OoyalaPlayer.enableCustomHLSPlayer = true;

As of April 1, 2016 the Ooyala Android SDKs have been shipping with Google ExoPlayer libraries instead of the VisualOn libraries. While there are steps that you will need to take, moving to ExoPlayer will provide a more consistent, higher quality HLS and MPEG-DASH playback experience for VOD and live streams on Android devices.

As of August 1, 2016, Ooyala will no longer support the HLS player integration with VisualOn or provide bug fixes or improvements specific to VisualOn libraries.

In order to upgrade, you will need to
Next, the sample application constructs a NielsenAnalytics object, passing in the player, the appID, the appName, the sfCode, and any applicable custom configuration settings (associated with the device) and custom metadata (associated with the asset). For more information about these arguments, refer to the API reference documentation included in the Ooyala Android Nielsen SDK distribution that you downloaded.
s_nielsenAnalytics = new NielsenAnalytics( this, player, this, NIELSEN_APPID, "0.1", "NielsenTestApp", NIELSEN_SFCODE, getCustomConfig(), null );
The getCustomConfig method shows passing the Nielsen debug flag via the customConfig JSON object.
private JSONObject getCustomConfig() {
  final JSONObject json = new JSONObject();
  try {
    json.put( "nol_devDebug", "true" ); // do NOT do this for production apps!
  catch( JSONException e ) {
    Log.e( TAG, "getCustomConfig()", e );
  return json;
The sample app also shows one example of how to implement the Nielsen user opt-out option. The optInOutButton, when clicked, calls showOptInOutUI, which in turn retrieves the Nielsen opt-out URL by calling getOptOutUrl.
private String getOptOutUrl() {
  if( s_nielsenAnalytics != null amp "#38;#38;" s_nielsenAnalytics.isValid() ) {
    return s_nielsenAnalytics.getNielsenAppSdk().userOptOutURLString();
  else {
    return null;
Note how getOptOutUrl obtains the URL by calling the Nielsen App SDK's userOptOutURLString method via Ooyala's getNielsenAppSdk API.
Similarly, when the app stops, the onstop method calls decrementRunningActivityCount, which invokes the Nielsen App SDK's stop method via Ooyala's getNielsenAppSdk API.
public void run() {
  DebugMode.logD( TAG, "onStop: we appear to be 'backgrounded'." );

Review the NielsenSampleApp for additional details on Nielsen integration in Ooyala Android apps.