Class NielsenPlugin
- java.lang.Object
-
- com.castlabs.android.Plugin
-
- com.castlabs.sdk.nielsen.NielsenPlugin
-
public class NielsenPlugin extends Plugin
This plugin integrates the Nielsen SDK. The plugin ensures that playback meta-data is send towards the Nielsen SDK and it allows you to access the Nielsen SDK instance.The latter is important because the plugin can not track application lifecycle fully, so you need to integrate the callbacks when you application goes to background. The foreground callback is triggered automatically when the player view component is registered.
Before you can use this plugin, you have to register it with the SDK:
PlayerSDK.register(new NielsenPlugin(...)); PlayerSDK.init(getApplicationContext());
Once registered, the
NielsenComponent
will be exposed by thePlayerView
. The internals of that component will make sure that the Nielsen SDK is created and initialized and that playback data is forwarded correctly. You can however access the Nielsen AppSdk through that component to add additional lifecycle calls (i.e. app goes to background) or integrate the opt-in or opt-out support. Here is an example how you can access the component:NielsenComponent nielsenComponent = playerView.getComponent(NielsenComponent.class); if (nielsenComponent != null && nielsenComponent.getAppSdk() != null) { nielsenComponent.getAppSdk().appInForeground(this); }
The integration uses the
AnalyticsMetaData
extract and provide additional information downstream. The channel information contains the playback URL and uses theAnalyticsMetaData.assetId
as the "channelName".The content meta data will contain all keys in the
AnalyticsMetaData.extra
bundle and will always set the "assetId" and the "length" based onAnalyticsMetaData.assetId
andAnalyticsMetaData.durationSeconds
unless they are already defined in the extras. The duration for VoD (i.e. non live) content is also taken from the player controller if not specified in the analytics meta-data.Besides the
NielsenComponent
, the plugin does also expose the instance of the AppSdk. This can be used for instance to handle opt-in/opt-out requests outside of playback. You can access the plugin dynamically after it was registered:NielsenPlugin nielsenPlugin = PlayerSDK.getPlugin(NielsenPlugin.class); AppSdk appSdk = nielsenPlugin.getAppSdk(); ...
- Since:
- 4.2.0
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONFIG_KEY_APPID
JSON Object configuration key for the app IDstatic String
CONFIG_KEY_APPNAME
JSON Object configuration key for the app namestatic String
CONFIG_KEY_APPVERSION
JSON Object configuration key for the app versionstatic String
CONFIG_KEY_SFCODE
JSON Object configuration key for the app SF Codestatic String
SF_CODE_DCR
The SF code for DCR
-
Constructor Summary
Constructors Constructor Description NielsenPlugin(String appId, String appName, String appVersion, String sfCode)
Create a new instance of the plugin with the given app id, app name and sf code that will be passed to the Nielsen SDK.NielsenPlugin(JSONObject configuration)
Create a new instance of the plugin using the given JSON Object to configure the Nielsen SDK
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NielsenComponent.AppSdk
getAppSdk()
Returns the instance of the App SDKString
getId()
void
setEnabled(boolean enabled)
Dynamically enable or disable nielsen integration for playbacks-
Methods inherited from class com.castlabs.android.Plugin
init, onRemotePlay
-
-
-
-
Field Detail
-
SF_CODE_DCR
public static final String SF_CODE_DCR
The SF code for DCR- See Also:
- Constant Field Values
-
CONFIG_KEY_APPID
public static final String CONFIG_KEY_APPID
JSON Object configuration key for the app ID- See Also:
- Constant Field Values
-
CONFIG_KEY_APPNAME
public static final String CONFIG_KEY_APPNAME
JSON Object configuration key for the app name- See Also:
- Constant Field Values
-
CONFIG_KEY_APPVERSION
public static final String CONFIG_KEY_APPVERSION
JSON Object configuration key for the app version- See Also:
- Constant Field Values
-
CONFIG_KEY_SFCODE
public static final String CONFIG_KEY_SFCODE
JSON Object configuration key for the app SF Code- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NielsenPlugin
public NielsenPlugin(String appId, String appName, String appVersion, String sfCode)
Create a new instance of the plugin with the given app id, app name and sf code that will be passed to the Nielsen SDK.- Parameters:
appId
- The App IDappName
- The App NameappVersion
- The App VersionsfCode
- The SF-Code
-
NielsenPlugin
public NielsenPlugin(@NonNull JSONObject configuration)
Create a new instance of the plugin using the given JSON Object to configure the Nielsen SDK- Parameters:
configuration
- The configuration that will be passed to the Nielsen SDK
-
-
Method Detail
-
setEnabled
public void setEnabled(boolean enabled)
Dynamically enable or disable nielsen integration for playbacks- Parameters:
enabled
- Enable or disable
-
getAppSdk
@NonNull public NielsenComponent.AppSdk getAppSdk()
Returns the instance of the App SDK- Returns:
- The App SDK
-
-