AppSDK(): Difference between revisions
From Engineering Client Portal
(Created page with "{{Breadcrumb|}} {{Breadcrumb|Digital}} {{Breadcrumb|Android SDK API Reference}} {{CurrentBreadcrumb}} Category:Digital Category:Android SDK API Reference <code>AppSdk...") |
m (Changes to add luid parameter in SDK init for Android) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 46: | Line 46: | ||
== Notes == | == Notes == | ||
=== JSON object | === JSON object for appInfo === | ||
The complete list of arguments that can be passed via the AppInfo JSON schema for the API are as follows: | |||
(The appid is provided by the Nielsen Technical Account Manager (TAM). The appid is a GUID data type and is specific to the application.) | |||
{| class="wikitable" | |||
|- | |||
! Parameter / Argument !! Description !! Source !! Required? !! Example | |||
|- | |||
| appid || Unique id for the application assigned by Nielsen. It is GUID data type. | |||
* Use Test appid during development, test, and certification processes | |||
* Use Production appid to submit app to App / Play store, after receiving Nielsen certification. | |||
|| Nielsen-specified || Yes || PXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX | |||
|- | |||
| sfcode || Nielsen collection facility to which the SDK should connect. | |||
'''DTVR''' | |||
* "us" for production | |||
'''DCR''' | |||
* "dcr" for production | |||
|| Nielsen-specified || Yes || dcr | |||
|- | |||
| longitude || This value will not be overwritten by SDK for International (Germany). || Client-defined || No || 123.22 | |||
|- | |||
| latitude || This value will not be overwritten by SDK for International (Germany). || Client-defined || No || -123.22 | |||
|- | |||
| dma || Nielsen Designated Market Area code. DMA must be the Nielsen DMA value. Please check with the Technical Account Manager. || Client-defined || No || 123 | |||
|- | |||
| ccode || If Country Code is provided by the app, it should be done after consultation with the Technical Account Manager. || Client-defined || No || 456 | |||
|- | |||
| hem_sha256 || SHA256-hashed email address (client-supplied unique 32-character hexadecimal string) || Client-defined || No || tMmiiTI7IaAcPpQPFQ65uMVCWH8av9jw4cwf/F5HVRQ= | |||
|- | |||
| hem_sha1 || SHA1-hashed email address (client-supplied unique 32-character hexadecimal string) || Client-defined || No || XvBniTI7IaAcPpQPFQ65uMVCWH8av9jw4cwf/F5HVRQ= | |||
|- | |||
| hem_md5 || MD5-hashed email address (client-supplied unique 32-character hexadecimal string) || Client-defined || No || JnIbdTI7IaAcPpQPFQ65uMVCWH8av9jw4cwf/F5HVRQ= | |||
|- | |||
| uid2 || An identifier based on a user’s verifiable PII (e.g. hashed email). UID2.0 was initially created by The Trade Desk (TTD) and is now managed by Prebid. || Client-defined || No || MTKVpUAzwYAPnHrtfE0wlINOMzhU7UUEjjVdCdRu63k= | |||
|- | |||
| uid2_token || Encrypted Unified ID 2.0 || Client-defined || No || AgAAAAPFR0zA5ogv/yaAPiUsAdZPsfqS8Ql | |||
DSGxAB+rr8yekFs3AjLYVk5qqqiyV2XHbSuwzHmxSlLeQeK | |||
QI1mp015jsNnpX5/xGgXldcgVz+gFnyh3T8/3agMwRmyrhC | |||
xG4oH2C7fc48AQk2eotE7FW0ZDEYM8fD9ZxDaxFUC/OV3OuZA& | |||
|- | |||
|luid | |||
|Living Unit ID - Experian Household ID | |||
'''Note: This parameter is applicable only for CTV and First Party Livestream data''' | |||
|Client-defined | |||
|No | |||
|B0EOFEDgD | |||
|} | |||
<syntaxhighlight lang="java"> | <syntaxhighlight lang="java"> | ||
JSONObject appSdkConfig = new JSONObject() | JSONObject appSdkConfig = new JSONObject() | ||
.put("appid", " | .put("appid", "PXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX") | ||
.put("sfcode", "uat-cert") | .put("sfcode", "uat-cert") | ||
.put("custom_key1", "custom_value1") | .put("custom_key1", "custom_value1") | ||
.put("custom_key2", "custom_value2"); | .put("custom_key2", "custom_value2"); | ||
// Pass appSdkConfig to the AppSdk constructor | |||
mAppSdk = new AppSdk(appContext, appSdkConfig, appSdkListener); | |||
} | |||
</syntaxhighlight> | </syntaxhighlight> | ||
=== JSON string format for appInfo === | === JSON string format for appInfo === | ||
The required items are | The required items are application ID (appid), designated market area (dma), Nielsen-assigned data node (sfcode), and the country code (ccode). | ||
<blockquote>'''Note:''' Notice that all quotes inside the string are escaped with a backslash (\).</blockquote> | <blockquote>'''Note:''' Notice that all quotes inside the string are escaped with a backslash (\).</blockquote> | ||
<syntaxhighlight lang="java"> | <syntaxhighlight lang="java"> | ||
"{ | "{"appid":"PXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX,"sfcode":"us"}" | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== iAppNotifier === | === iAppNotifier === | ||
Client apps subscribe to the App SDK event listener to be notified about App SDK events. To implement, | Client apps can subscribe to the App SDK event listener to be notified about App SDK events. To implement this feature, create a plain old java object (POJO) that implements the interface <code>com.nielsen.app.sdk.IAppNotifier</code>. Do not implement with the main activity class as this creates a strong reference and interferes with memory release. | ||
<syntaxhighlight lang="java"> | <syntaxhighlight lang="java"> | ||
Line 78: | Line 130: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Note that implementing the event listener is '''optional'''. | |||
==== AppSdk events ==== | ==== AppSdk events ==== |
Latest revision as of 00:06, 13 June 2024
AppSdk()
is the public constructor used for initializing the App SDK Analytics framework.
- The reference to the App SDK object returned by the Appsdk constructor.
- App SDK supports multiple instances (max. four) to measure multiple players simultaneously.
- context, appInfo parameters are mandatory and should not be NULL values.
- The constructor should never return null.
Debug flag for development environment
Player application developers / integrators can use Debug flag to check whether an App SDK API call made is successful. To activate the Debug flag,
- Pass the argument
+ ""nol_devDebug" : "" + "I" + "",",
while initializing the App SDK object. The permitted values are- 'I' (INFO): Displays the API calls and the input data from the application (validate player name, app ID, etc.). It can be used as certification Aid.
- 'W' (WARNING): Indicates potential integration / configuration errors or SDK issues.
- 'E' (ERROR): Indicates important integration errors or non-recoverable SDK issues.
- 'D' (DEBUG): Debug logs, used by the developers to debug more complex issues.
Once the flag is active, it logs each API call made and the data passed. The log created by this flag is minimal.
Note: DO NOT activate the Debug flag in production evironment.
Syntax
public AppSdk(Context context, JSONObject appInfo, IAppNotifier notifier);
Input Parameters
Parameter | Description |
---|---|
context | The context from the App |
appInfo | JSON object that defines the application information. |
notifier | Client-provided object implementing the iAppNotifier interface. Can be ‘null’ if not provided by client. |
Output Parameters
Output Parameters (Return value) | Description |
---|---|
A reference to the instance. Else Null object |
Notes
JSON object for appInfo
The complete list of arguments that can be passed via the AppInfo JSON schema for the API are as follows: (The appid is provided by the Nielsen Technical Account Manager (TAM). The appid is a GUID data type and is specific to the application.)
Parameter / Argument | Description | Source | Required? | Example |
---|---|---|---|---|
appid | Unique id for the application assigned by Nielsen. It is GUID data type.
|
Nielsen-specified | Yes | PXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX |
sfcode | Nielsen collection facility to which the SDK should connect.
DTVR
DCR
|
Nielsen-specified | Yes | dcr |
longitude | This value will not be overwritten by SDK for International (Germany). | Client-defined | No | 123.22 |
latitude | This value will not be overwritten by SDK for International (Germany). | Client-defined | No | -123.22 |
dma | Nielsen Designated Market Area code. DMA must be the Nielsen DMA value. Please check with the Technical Account Manager. | Client-defined | No | 123 |
ccode | If Country Code is provided by the app, it should be done after consultation with the Technical Account Manager. | Client-defined | No | 456 |
hem_sha256 | SHA256-hashed email address (client-supplied unique 32-character hexadecimal string) | Client-defined | No | tMmiiTI7IaAcPpQPFQ65uMVCWH8av9jw4cwf/F5HVRQ= |
hem_sha1 | SHA1-hashed email address (client-supplied unique 32-character hexadecimal string) | Client-defined | No | XvBniTI7IaAcPpQPFQ65uMVCWH8av9jw4cwf/F5HVRQ= |
hem_md5 | MD5-hashed email address (client-supplied unique 32-character hexadecimal string) | Client-defined | No | JnIbdTI7IaAcPpQPFQ65uMVCWH8av9jw4cwf/F5HVRQ= |
uid2 | An identifier based on a user’s verifiable PII (e.g. hashed email). UID2.0 was initially created by The Trade Desk (TTD) and is now managed by Prebid. | Client-defined | No | MTKVpUAzwYAPnHrtfE0wlINOMzhU7UUEjjVdCdRu63k= |
uid2_token | Encrypted Unified ID 2.0 | Client-defined | No | AgAAAAPFR0zA5ogv/yaAPiUsAdZPsfqS8Ql
DSGxAB+rr8yekFs3AjLYVk5qqqiyV2XHbSuwzHmxSlLeQeK QI1mp015jsNnpX5/xGgXldcgVz+gFnyh3T8/3agMwRmyrhC xG4oH2C7fc48AQk2eotE7FW0ZDEYM8fD9ZxDaxFUC/OV3OuZA& |
luid | Living Unit ID - Experian Household ID
Note: This parameter is applicable only for CTV and First Party Livestream data |
Client-defined | No | B0EOFEDgD |
JSONObject appSdkConfig = new JSONObject()
.put("appid", "PXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")
.put("sfcode", "uat-cert")
.put("custom_key1", "custom_value1")
.put("custom_key2", "custom_value2");
// Pass appSdkConfig to the AppSdk constructor
mAppSdk = new AppSdk(appContext, appSdkConfig, appSdkListener);
}
JSON string format for appInfo
The required items are application ID (appid), designated market area (dma), Nielsen-assigned data node (sfcode), and the country code (ccode).
Note: Notice that all quotes inside the string are escaped with a backslash (\).
"{"appid":"PXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX,"sfcode":"us"}"
iAppNotifier
Client apps can subscribe to the App SDK event listener to be notified about App SDK events. To implement this feature, create a plain old java object (POJO) that implements the interface com.nielsen.app.sdk.IAppNotifier
. Do not implement with the main activity class as this creates a strong reference and interferes with memory release.
//pass the implementing object to the AppSdk constructor in order to subscribe to the eventlistener:
mAppSdk = new AppSdk(context, appInfo,iappNotifierObject)
Optionally, implement an object derived from the interface, as below. This object will allow listening for events within the App SDK.
public interface iAppNotifier
{
public void onAppSdkEvent(long timestamp, int code, String description);
}
Note that implementing the event listener is optional.
AppSdk events
There are three events currently exposed on the App SDK.
public static final int EVENT_INITIATE = 2000;
- App SDK notifies that it is going to be initialized.
public static final int EVENT_STARTUP = 2001;
- The App SDK has just started up. It will happen only after the App SDK has received a valid config file from Nielsen. This is the location in the code to acquire value of
userOptOutURLString()
.
public static final int EVENT_SHUTDOWN = 2002;
- The App SDK is shutting down. It will happen only when the App SDK is destroyed.