DCR & DTVR Android Adobe Launch Extension

From Engineering Client Portal

Engineering Portal breadcrumbArrow.png Digital breadcrumbArrow.png DCR & DTVR breadcrumbArrow.png DCR & DTVR Android Adobe Launch Extension

Adobe Launch Extensions

Adobe Launch Extensions are building blocks for mobile application development. The necessary functionality can be implemented independently and put to separate Extensions, but make them able to communicate using Events. These Extensions are live in adobe launch environment and can be used by clients who develop their mobile applications using adobe launch mobile property.

Nielsen AppSDK Extension

Nielsen provides the Adobe Launch Extension based on AppSDK for measuring the video/audio content. It has the name Nielsen AppSDK Extension and is available for android and iOS mobile platforms.

Extension Installation and Configuration

Nielsen has developed an Extension to simplify adding Nielsen measurement into your video stream. The first step is to create and publish a property which is outlined in the Getting Started Guide.

Configure the Extension

If the user doesn’t want to set the AppSdk configuration in the code and wants to make the AppSdk configuration more flexible and changeable on the fly, it can be configured through the launch interface. In order to do that, go to the collection of installed extensions of the property. icon The configuration allows to set different configuration for iOS and Android platforms: icon

Build the Extension

After the Extension is configured, it can be “built” under the “library” on the Publishing page with other “libraries”. It is the main step for adding the configuration to the main configuration file and to register the package under specific App Id after building it.

Add a New library

Select to add a new library

icon

Set the name, chose Environment (Production, Staging, Development):

icon

Save and Build

Add all changed resources. When you get the Extension configured, it will appear in the list of changed resources. Select the Latest revision and press “Select & Create a New Revision” button: icon

Confirm

Once built, it will appear in the list of Development libraries:

icon

View in Library

Once it is set up, the user will be prompted to the Environments page where it can be Installed.

icon

Obtain Gradle Installation Instructions and code snipet

You will then be provided the Mobile Installation Instructions.

icon

How to install the Nielsen AppSDK using Gradle for Android

Below are the steps which needs to be performed by app developers to integrate nielsen app sdk within an android application.

Update gradle.properties

The first step is to add the credentials received from Nielsen into your gradle.properties file, generally near the end of the file. We recommend using the version in your home folder (Global Properties). Gradle looks for gradle.properties files in this sequence:

  • gradle.properties in project root directory.
  • gradle.properties in GRADLE_USER_HOME directory.
  • system properties, e.g. when -Dgradle.user.home is set on the command line.

Properties from one file will override the properties from the previous ones (so file in gradle user home has precedence over the others, and file in sub-project has precedence over the one in project root).

Reference: https://gradle.org/docs/current/userguide/build_environment.html

machine raw.githubusercontent.com
nielsen_user=<Nielsen App SDK client>
nielsen_authCode=<Auth token>

Credentials

Obtain credentials → here ←

Add Nielsen Maven Repository

Please add the nielsen maven repository inside the repositories section of your app's module build.gradle file like below:

android{ 
repositories {
   //Copy below code inside repository section of app’s build.gradle file
maven { url 'https://raw.githubusercontent.com/NielsenDigitalSDK/nielsenappsdk-extension-android/master/'
   credentials {
      //Make sure you add nielsen_user and nielsen_passwd with respective nielsen provided
     // values to global gradle.properties file
       username = project.property("nielsen_user")
       password = project.property("nielsen_authCode")
   }
   authentication {
       basic(BasicAuthentication)
   }
}
}

}

Add gradle dependency

Please add nielsen app sdk as compile time dependency inside build.gradle file as below

gradle 4.x and above

For gradle version starting with 4.x add below line inside dependencies section of build.gradle file.

implementation 'com.nielsenappsdk.extension:${flavour}:${version}'

gradle prior to 4.x

For gradle version previous to 4.x add below line inside dependencies section of build.gradle file.

compile 'com.nielsenappsdk.extension:${flavour}:${version}'

Adding Dependency

Below is an example for dependency

dependencies { ....
implementation 'com.nielsenappsdk.extension:global:1.0.0'
}

Sync

If you are finished with all previous steps then you can sync your build.gradle and after successful build you are ready to use nielsen app sdk library in your code.


Integration

To use nielsen app sdk extension in your android code you need to register your extension inside your Application class or very first activity like below. Please make sure that you register it only once in complete life cycle of your application.

//Register Nielsen extension and configure adobe launch mobile core
  MobileCore.setApplication(this);
  MobileCore.setLogLevel(LoggingMode.DEBUG); //Log level can be changed to your required one 

   //Register NielsenSdkExtension 
   NielsenSdkExtension.registerExtension();
   //Pass application context to NielsenSdkExtension
   NielsenSdkExtension.setApplicationContext(getApplicationContext());
   //Register notify listener to listen errors or messages informed by extension
   NielsenSdkExtension.registerNotifyEventListener(ExtensionErrorListener.class);
   Identity.registerExtension();
   Lifecycle.registerExtension();
   Signal.registerExtension();
   UserProfile.registerExtension();
   MobileCore.start(new AdobeCallback()
  {
       @Override
       public void call(Object o) 
       {
MobileCore.configureWithAppID("adobe launch configuration id");
       }
   });

Communication

The communication with the Extension happens by two separate flows: API and Events. The first one just redirects Extension’s class-access methods to direct instances of the NielsenAppSDK. The second one works with MobileCore’s EventHub - the core of the extension. Through the Hub the Core receives all the events and notifies the listeners if they are subscribed for them.

NOTE: be aware of mixing the approaches. Because of different architectures for API approach and Event approach (and the asynchronous nature of Events), it is not guaranteed that events and API will be handled in order of their call.

The list of APIs (the meaning of each event and API is described later in this document)

Public APIs exposed by extension

//This function should be called to register extension
public static boolean registerExtension()

//This function should be called to set app context inside extension
public static void setApplicationContext(Context cntx)

//This function should be called to listen errors informed by extension
public static JSONObject registerNotifyEventListener(Class<T> extensionListenerClass)

//This function should be called to create app sdk instance with app info from launch configuration page
//This will return json object like {'identifier':'unique identifier', 'code':integer_error_code,'description':'string message'}
//Application should remember returned 'identifier' value for later use.
public static JSONObject instantiateSdkWithRemoteConfig()

//This function should be called to create app sdk instance with app info passed as argument
//This will return json object like {'identifier':'unique identifier', 'code':integer_error_code,'description':'string message'}
//Application should remember returned 'identifier' value for later use.
public static JSONObject instantiateSdkWithConfig(JSONObject appInfo)

//This function should be called to remove already created app sdk instance.
//Pass identifier received while creating app sdk instance
//This will return json object like {'code':integer_error_code,'description':'string message'}
public static JSONObject removeSdkInstance(String sdkId)

//This function should be called to pass metadata to app sdk instance.
//Pass identifier received while creating app sdk instance along with metadata
public static JSONObject trackSdkEvent(String sdkId, JSONObject eventData)

//This function should be called to get opt out status from app sdk instance.
//Pass identifier received while creating app sdk instance
//This function should be called on worker thread but not on main thread
//This will return json object like {'optout_status':1,'code':integer_error_code,'description':'string message'}
public static JSONObject getOptoutStatus(String sdkId)

//This function should be called to inform that app sdk is in foreground.
//Pass identifier received while creating app sdk instance
//This will return json object like {'code':integer_error_code,'description':'string message'}
public static JSONObject appInForeground(String sdkId)

//This function should be called to inform that app sdk is in background.
//Pass identifier received while creating app sdk instance
//This will return json object like {'code':integer_error_code,'description':'string message'}
public static JSONObject appInBackground(String sdkId)

//This function should be called to get demographic id from app sdk instance.
//Pass identifier received while creating app sdk instance
//This function should be called on worker thread but not on main thread
//This will return json object like {'demographic_id':'XXXXXXXXXX','code':integer_error_code,'description':'string message'}
public static JSONObject getDemographicId(String sdkId)

//This function should be called to set disable/enable state of app sdk.
//Pass identifier received while creating app sdk instance along with true/false
public static JSONObject appDisableApi(String sdkId, boolean disable)

//This function should be called to get app sdk's current disable state.
//Pass identifier received while creating app sdk instance
//This will return json object like {'app_disable':1,'code':integer_error_code,'description':'string message'}
public static JSONObject getAppDisable(String sdkId)

//This function should be called to get app sdk's opt out url string.
//Pass identifier received while creating app sdk instance
//This will return json object like {'optout_url':'url','code':integer_error_code,'description':'string message'}
public static JSONObject userOptOutURLString(String sdkId)

//This function should be called to get app sdk's version.
//This will return json object like {'meter_version':'6.1.0.1','code':integer_error_code,'description':'string message'}
public static JSONObject getMeterVersion()

//This function should be called to check if app sdk is valid or in-valid.
//Pass identifier received while creating app sdk instance
//This will return json object like {'is_valid':1,'code':integer_error_code,'description':'string message'}
public static JSONObject isValid(String sdkId)

//This function should be called to close app sdk instance.
//Pass identifier received while creating app sdk instance
public static JSONObject close(String sdkId)

Events

  1. InstantiateSDKWithLocalConfigEvent
  2. InstantiateSDKWithRemoteConfigEvent
  3. RemoveSDKInstanceEvent
  4. TrackSDKEvent
  5. GetOptoutStatusEvent
  6. GetAppDisableEvent
  7. SetAppDisableEvent
  8. GetDemographicIdEvent
  9. GetOptoutURLEvent
  10. GetMeterVersionEvent


In order to fire the event, the next API of the ACPCore should be used:

AdobeCallback responseCallback = new AdobeCallback<Event>()
{
  @Override
  public void call(Event event)
  {
   }
};
ExtensionErrorCallback errorCallback = new ExtensionErrorCallback() {
  @Override
  public void error(Object o) {    
  }
};

HashMap eventData = new HashMap();
Event instantiateEvent = new Event.Builder(event name, NielsenSdkExtension.NielsenEventType, NielsenSdkExtension.NielsenEventSource).setEventData(eventData).build();
MobileCore.dispatchEventWithResponseCallback(instantiateEvent, responseCallback, errorCallback);

The Extension listens for specific events’ type and source and handles specific event names differently. The API and Event flows are mirroring each other. And they are mirroring NielsenAppSDK’s api.

Result

The result format that is returning with API flow and with Event flow is the same for both flows - this is a JSON object.

It consists of the result code, description and the identifier. { ‘identifier’ : ‘...’, //might not be there if the “remove” API or Event is made ‘code’ : 5001, ‘description’ : ‘...’ }

Possible error codes are:

public static final int ResultCodeSuccess = 5001;
public static final int ResultCodeUnknownError = 5002;
public static final int ResultCodeRemoteConfigNotAvailable = 5003;
public static final int ResultCodeInvalidAppInfo = 5004;
public static final int ResultCodeInvalidParameters = 5005;
public static final int ResultCodeSdkInstantiationError = 5006;
public static final int ResultCodeEventListenerRegistrationFailed = 5007;
public static final int ResultCodeExtensionRegistrationFailed = 5008;
public static final int ResultCodeExtensionNotRegistered = 5009;
public static final int ResultCodeInvalidSdkInstance = 5010;
public static final int ResultCodeExceptionOccurred = 5011;
public static final int ResultCodeInvalidEventData = 5012;
public static final int ResultCodeInvalidAppContext = 5013;

API and Events description

Instantiating the SDK

NielsenAppSDK can support multiple instances, and not to lose this feature, the Extension keeps SDK instances by the identifiers. When the user requests to create the instance, the Extension instantiates it and returning back the identifier which the user will use for further SDK control.

There are two ways of initializing the SDK with configuration: the configuration provided in the code and configuration that is set up on the Adobe Launch panel of your property.

To support four flows (API, Events, Local Configuration and the Remote Configuration) the next APIs and events are introduced:

JSONObject result = NielsenSdkExtension.instantiateSdkWithConfig(jsonObject);
JSONObject result = NielsenSdkExtension.instantiateSdkWithRemoteConfig();


"InstantiateSDKWithLocalConfigurationEvent"
"InstantiateSDKWithRemoteConfigurationEvent"

To provide the configuration for InstantiateSDKWithLocalConfigurationEvent event, put the configuration under the "data" key in the JSON object:

{
	"data" : {"appid":"...", "sfcode":"..."}
}

The result of those APIs and events is a JSON object. It returns the identifier string under which a newly created instance is kept. Use the identifier to make further calls to control the NielsenAppSDK.

JSON Initialization Data

The following table contains the list of arguments that should be passed during initialization.

  • The appid is provided by the Nielsen Technical Account Manager (TAM).
Parameter / Argument Description Source Required? Example
appid Unique id for the application assigned by Nielsen.

It is GUID data type, provided by the Nielsen Technical Account Manager (TAM).

Nielsen-specified Yes PXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
appname Name of the application Client-defined No "Nielsen Sample App"
appversion Current version of the app used Client-defined No "1.0.2"
sfcode Nielsen collection facility to which the SDK should connect.

DTVR

  • "us"

Digital Audio

  • "drm"

DCR

  • "dcr"
Nielsen-specified Yes "dcr"
containerId View ID of the UI element used as player view in application for Viewability (Future Feature) Client-defined No "1234567"
nol_devDebug Enables Nielsen console logging. Only required for testing Nielsen-specified Optional "DEBUG"


Sample SDK Initialization Code

Initialization of App SDK object through a JSON object

  
import android.content.Context;
import com.nielsen.sdkextension.NielsenSdkExtension;
import org.json.JSONException;
import org.json.JSONObject;

   @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // In SDKMethods class we wrote methods which creates content,Ad objects
        sdkMethods = new SDKMethods();

        initUI();

        sdkData = NielsenSdkExtension.instantiateSdkWithRemoteConfig();

        if(sdkData != null){

            try {
                identifier = sdkData.getString("identifier");
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }

   private JSONObject initSDK(){

        JSONObject appInformation = null;

        try {
            appInformation = new JSONObject()
                    .put("appid", "PDA7D5EE6-B1B8-4123-9277-XXXXXXXXXXXX")
                    .put("appversion", "1.0")
                    .put("sfcode", "dcr")
                    .put("uoo", "0")
                    .put("nol_devDebug", "DEBUG");
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return appInformation;
    }

Removing the SDK instance

In order to remove the instance that the Extension is keeping, call the remove API or fire an event with providing the identifier.

JSONObject result =  NielsenSdkExtension.removeSdkInstance("identifier");


"RemoveSDKInstanceEvent"

To provide the identifier for "RemoveSDKInstanceEvent" event, put the configuration under the "identifier" key in the JSON object:

{
	"identifier" : "the identifier under which instance is kept"
}

All result returned are in JSON object

Tracking the SDK Event

To track NielsenAppSDK’s event, call the track SDK Event API, or fire an event with providing the identifier.

JSONObject result =  NielsenSdkExtension.trackSdkEvent("identifier");

Event Types

The following event types are supported:

Key Description
playhead

It is used to pass content, ad or static metadata, the current playhead value, Unix timestamp or id3 payload, OTT information to the SDK.

pause

This event should be used to in the following cases: application enters background, any application interruptions, content playback is paused. (Pause is detected by SDK automatically only if the time gap between commands exceeds 30 minutes.)

complete

It is called when session is completed or ends.

adStop

This event should be called at the end of each ad and is required when advertisements have the same assetId.


To provide the identifier for “TrackSDKEvent” event, put the identifier under the “identifier” key in the JSON object and the event metadata:

{
	"identifier" : "the identifier under which instance is kept",
	"data" : {"event":"playhead", "playheadPosition":"0", ...}
}

Handling JSON Metadata

Parameter “data” is a JSON object with many key-value pairs that holds all information required by SDK.

Format of input object is the following:

{ 
 "event": <event identifier>,
 "type": <type of metadata>,
 "metadata":{ 
   "content": <content metadata object>,
   "ad": <ad metadata object>,
   "static": <static metadata object>
 },
 "playheadPosition":<playhead value | Unix Timestamp>,
 "id3Data": <id3 payload>,
}


DCR

Digital Content Ratings

Parameter Description Supported values Example
event Event identifier

String: playhead,pause,complete, adStop

"event":"playhead"
type Determines the metadata object

that should be used for crediting.

String:
content, ad, static

"type":"content"
metadata Object that holds metadata values of specific types

Detailed in tables below

Object
"metadata":{ 
   "content": <content metadata object>,
   "ad": <ad metadata object>,
   "static": <static metadata object>
 },
playheadPosition Playhead value as reported by video player.
Unix timestamp (seconds since Jan-01-1970 UTC) for live video.
String

Position value is Unix timestamp (live): "playheadPosition":"1542797780"

Position value is playhead:

"playheadPosition":"10"

Content Metadata

Content metadata sent for every playheadposition update.

Keys Description Example Required
assetName name of program (100 character limit) "MyTest789" Yes
assetid unique ID assigned to asset custom Yes
length length of content in seconds seconds (0 for live stream or unknown) Yes
program name of program (100 character limit) custom Yes
segB custom segment B ¹ custom
segC custom segment C ¹ custom
title name of program (100 character limit) custom Yes
type 'content', 'ad', 'static' 'content' Yes
section Unique Value assigned to page/site section HomePage Yes
airdate the airdate in the linear TV ² YYYYMMDD HH24:MI:SS Yes
isfullepisode full episode flag "y"- full episode, "n"- non full episode Yes
crossId1 standard episode ID custom
crossId2 content originator (only required for distributors) Nielsen provided
adloadtype linear vs dynamic ad model 1=Linear

2=Dynamic Ads

custom

¹ Custom segments (segB and segC) can be used to aggregate video and/or static content within a single Brand to receive more granular reports within a brand.
² Acceptable Air Date Formats:

YYYYMMDD HH24:MI:SS
YYYYMMDDHH24MISS
YYYY-MM-DDTHH:MI:SS
YYYY-MM-DDHH:MI:SS 
YYYYMMDDHH:MI:SS
MM-DD-YYYY
YYYYMMDD HH:MI:SS


For USA all times should be EST, for all other countries Local Time. Below is a sample event for DCR. If no ad or static values, these can be left as blank/null.

{ 
"event": "playhead",
"type": "content",
"metadata": { 
  "content":{
    "assetName":"Big Buck Bunny",
    "assetid":"B66473",
    "length":"3600",
    "program":"MyProgram",
    "segB":"CustomSegmentValueB",
    "segC":"segmentC",
    "title":"S2,E3",
    "type":"content",
    "section":"cloudApi_app",
    "airdate":"20180120 10:00:00",
    "isfullepisode":"y",
    "crossId1":"Standard Episode ID",
    "crossId2" :"Content Originator",
    "adloadtype":"2"},
"ad": {},
"static": {}
},
"playheadPosition": "",
}

DTVR

Digital TV Ratings info

Parameter Description Supported values Example
event Event identifier

String: playhead,pause,complete, adStop

"event":"playhead"
type Determines the metadata object that should be used for crediting.

String:
content, ad, static

"type":"content"
adModel linear vs dynamic ad model 1=Linear

2=Dynamic Ads

custom
channelName Any string representing the.channel/stream Object custom
playheadPosition Playhead value or Unix timestamp (seconds since Jan-01-1970 UTC) String

Position value is Unix timestamp: "playheadPosition":"1542797780"

Position value is playhead:

"playheadPosition":"10"

id3Data Nielsen ID3 payload String

"id3Data": "www.nielsen.com/065H2g6E7ZyQ5UdmMAbbpg ==/_EMc37zfVgq_8KB7baUYfg==/ADQCAmgV1Xyvnynyg60 kZO_Ejkcn2KLSrTzyJpZZ-QeRn8GpMGTWI7-HrEKzghxyzC yBEoIDv2kA2g1QJmeYOl5GnwfrLDVK2bNLTbQxr1z9VBfxa hBcQP5tqbjhyMzdVqrMKuvvJO1jhtSXa9AroChb11ZUnG1W VJx2O4M=/33648/22847/00"

Below is a sample event for DTVR. If no ad or static values, these can be left as blank/null.

{ 
"event": "playhead",
"type": "content",
"metadata": { 
  "content":{
    "adModel":"1",
    "channelname":"channel1"
  },
"ad": {},
"static": {}
},
"playheadPosition": "",
"id3Data": "www.nielsen.com/065H2g6E7ZyQ5UdmMAbbpg==/_
EMc37zfVgq_8KB7baUYfg==/ADQCAmgV1Xyvnynyg60kZO_Ejkcn
2KLSrTzyJpZZ-QeRn8GpMGTWI7-HrEKzghxyzCyBEoIDv2kA2g1Q
JmeYOl5GnwfrLDVK2bNLTbQxr1z9VBfxahBcQP5tqbjhyMzdVqrMK
uvvJO1jhtSXa9AroChb11ZUnG1WVJx2O4M=/33648/22847/00"
}

DCR & DTVR

Applies to DCR and DTVR

Parameter Description Supported values Example
event Event identifier

String: playhead, pause, complete, adStop

"event":"playhead"
type Determines the metadata object that should be used for crediting.

String:
content, ad, static

"type":"content"
metadata Object that holds metadata values of specific types

Detailed in tables below

Object
"metadata":{ 
   "content": <content metadata object>,
   "ad": <ad metadata object>,
   "static": <static metadata object>
 },
playheadPosition Playhead value or Unix timestamp (seconds since Jan-01-1970 UTC) String

Position value is Unix timestamp: "playheadPosition":"1501225191747"

Position value is playhead:

"playheadPosition":"10"

id3Data Nielsen ID3 payload Object

"id3Data": "www.nielsen.com/065H2g6E7ZyQ5UdmMAbbpg ==/_EMc37zfVgq_8KB7baUYfg==/ADQCAmgV1Xyvnynyg60 kZO_Ejkcn2KLSrTzyJpZZ-QeRn8GpMGTWI7-HrEKzghxyzC yBEoIDv2kA2g1QJmeYOl5GnwfrLDVK2bNLTbQxr1z9VBfxa hBcQP5tqbjhyMzdVqrMKuvvJO1jhtSXa9AroChb11ZUnG1W VJx2O4M=/33648/22847/00"

ottData Object that holds OTT information Object
"ottData": {
   "ottStatus": 1,
   "ottType": casting,
   "ottDevice": chromecast,
   "ottDeviceID": 1234
}

Content Metadata

Content metadata sent for every playheadposition update.

Keys Description Example Required
length length of content in seconds seconds (0 for live stream) Yes
type "content", "ad", "static" "content" Yes
adModel linear vs dynamic ad model 1=Linear

2=Dynamic Ads

custom
adloadtype DCR Ad Model 1=Linear

2=Dynamic Ads

custom

+ Custom segments (segB and segC) can be used to aggregate video and/or static content within a single Brand to receive more granular reports within a brand.
++ Acceptable Air Date Formats:

YYYYMMDD HH24:MI:SS
YYYYMMDDHH24MISS
YYYY-MM-DDTHH:MI:SS
YYYY-MM-DDHH:MI:SS 
YYYYMMDDHH:MI:SS
MM-DD-YYYY
YYYYMMDD HH:MI:SS


Below is a sample event for DCR/DTVR joint integration. If no ad or static values, these can be left as blank/null.

{ 
"event": "playhead",
"type": "content",
"metadata": { 
  "content":{
    "type":"content",
    "length":"0",
    "adModel":"1",
    "adloadtype":"1"},
  "ad": {},
  "static": {}
},
"playheadPosition": "",
"id3Data": "www.nielsen.com/065H2g6E7ZyQ5UdmMAbbpg==/_
EMc37zfVgq_8KB7baUYfg==/ADQCAmgV1Xyvnynyg60kZO_Ejkcn
2KLSrTzyJpZZ-QeRn8GpMGTWI7-HrEKzghxyzCyBEoIDv2kA2g1Q
JmeYOl5GnwfrLDVK2bNLTbQxr1z9VBfxahBcQP5tqbjhyMzdVqrMK
uvvJO1jhtSXa9AroChb11ZUnG1WVJx2O4M=/33648/22847/00"
}

Retrieving the Opt Out Status

To get the opt out/opt in status, call according API or fire an event with providing the identifier.

JSONObject result =  NielsenSdkExtension.getOptoutStatus("identifier");


"GetOptoutStatusEvent"

To provide the identifier for "GetOptoutStatusEvent" event, put the identifier under the “identifier” key in the JSON object:

{
	"identifier" : "the identifier under which instance is kept"
}

The result of those APIs and events is a JSON object. The status is provided in the json object under the “optout_status” key:

{
	"optout_status" : 0 or 1,
	...}

Enabling and disabling the SDK

The user is able to get the SDK disabled if he doesn’t want to use its functionality. To use it, the disable API or Event should be made. To get the status, call API or fire an Event for getting the status.


JSONObject result =  NielsenSdkExtension.appDisableApi("identifier", true/false);

JSONObject result =  NielsenSdkExtension.getAppDisable("identifier");


"SetAppDisableEvent"
"GetAppDisableEvent"

To provide the identifier for "SetAppDisableEvent” event, put the identifier under the “identifier” key in the JSON object and if it is needed to disable the SDK, provide the value of 1 for “app_disable” key:

{
	"identifier" : "the identifier under which instance is kept"
}

To retrieve the status just provide the identifier in the object for the "GetAppDisableEvent" event:

{
"identifier" : "the identifier under which instance is kept"
}

The status for "GetAppDisableEvent" event is provided in the json object under the “app_disable” key:

{
"app_disable" : 0 or 1,
}


Retrieving the Demographic Identifier

To get the demographic identifier, call according API or fire an event with providing the identifier.

JSONObject result =  NielsenSdkExtension.getDemographicId("identifier");


"GetDemographicIdEvent"

To provide the identifier for “GetDemographicIdEvent” event, put the identifier under the “identifier” key in the JSON object:

{
	"identifier" : "the identifier under which instance is kept"
}

The result of those APIs and events is a JSON object. The demographic identifier is provided in the json object under the “demographic_id” key:

{
"demographic_id" : "the demographic identifier",
	...
}

Retrieving the OptOut URL

To get the opt out URL, call according API or fire an event with providing the identifier.

JSONObject result =  NielsenSdkExtension.userOptOutURLString("identifier");


"GetOptoutURLEvent"

To provide the identifier for “GetOptoutURLEvent” event, put the identifier under the “identifier” key in the JSON object:

{
	"identifier" : "the identifier under which instance is kept"
}

The result of those APIs and events is a JSON object. The opt out URL is provided in the json object under the "optout_url" key:

{
"optout_url" : "https://optout.url",
	...
}

Retrieving the SDK Version

To get the SDK version, call according API or fire an event with providing the identifier.

JSONObject result =  NielsenSdkExtension.getMeterVersion("identifier");


"GetMeterVersionEvent"

To provide the identifier for "GetMeterVersionEvent" event, put the identifier under the “identifier” key in the JSON object:

{
	"identifier" : "the identifier under which instance is kept"
}

The result of those APIs and events is a JSON object. The version of the SDK is provided in the json object under the "meter_version" key:

{
"meter_version" : "version of the meter",
	...}

Listening for NielsenAppSDK error events

If something happening in the internal kitchen of the SDK, it is always useful to get this information and use it. In order to achieve this, the Extension fires specific event to the EventHub, so user from the outside is able to listen to it and get the info. The listener can be built as standard ACPExtensionListener child of the MobileCore framework.

Once the class is created and the “hear” method is implemented, the listener can be registered by the NielsenAppSDKExtension using next API:

{
public static JSONObject registerNotifyEventListener(Class<T> extensionListenerClass)
	...}

As per the architecture of the MobileCore, user doesn’t have access to the instance of the EventListener. But in order to be able to show a result somewhere, write to specific file, and so forth, he might fire Notification so the observers will be notified about the error happened (for example, a File Manager that will write the error to the file.

{
public class AppEventListener extends ExtensionListener
{
    @Override
    public void hear(Event event)
    {
        //handle received event here...   
    }
}