Package com.castlabs.sdk.conviva
Class ConvivaPlugin
- java.lang.Object
-
- com.castlabs.android.Plugin
-
- com.castlabs.sdk.conviva.ConvivaPlugin
-
public class ConvivaPlugin extends Plugin
This plugin integrates Conviva Analytics with the castLabs Player SDK. You can enable and register the plugin before you initialize the SDK:
Please note that you can customize the client settings (seepublic class MyApp extends Application {
@
Override public void onCreate() { super.onCreate(); ConvivaPlugin convivaPlugin = new ConvivaPlugin(C.CONVIVA_CUSTOMER_KEY); if (BuildConfig.DEBUG) { HashMap<String, Object> settings = new HashMap<>(); settings.put(ConvivaSdkConstants.GATEWAY_URL, C.CONVIVA_TOUCHSTONE_GATEWAY); settings.put(ConvivaSdkConstants.LOG_LEVEL, ConvivaSdkConstants.LogLevel.DEBUG); convivaPlugin.setSettings(settings); } HashMap<String, String> deviceInfo = new HashMap<>(); final String prefix = "Test: "; deviceInfo.put(ConvivaSdkConstants.DEVICEINFO.ANROID_BUILD_MODEL, prefix + ConvivaSdkConstants.DEVICEINFO.ANROID_BUILD_MODEL); deviceInfo.put(ConvivaSdkConstants.DEVICEINFO.OPERATING_SYSTEM_VERSION, prefix + ConvivaSdkConstants.DEVICEINFO.OPERATING_SYSTEM_VERSION); deviceInfo.put(ConvivaSdkConstants.DEVICEINFO.DEVICE_BRAND, prefix + ConvivaSdkConstants.DEVICEINFO.DEVICE_BRAND); deviceInfo.put(ConvivaSdkConstants.DEVICEINFO.DEVICE_MANUFACTURER, prefix + ConvivaSdkConstants.DEVICEINFO.DEVICE_MANUFACTURER); deviceInfo.put(ConvivaSdkConstants.DEVICEINFO.DEVICE_MODEL, prefix + ConvivaSdkConstants.DEVICEINFO.DEVICE_MODEL); deviceInfo.put(ConvivaSdkConstants.DEVICEINFO.DEVICE_TYPE, prefix + ConvivaSdkConstants.DEVICEINFO.DEVICE_TYPE); deviceInfo.put(ConvivaSdkConstants.DEVICEINFO.DEVICE_VERSION, prefix + ConvivaSdkConstants.DEVICEINFO.DEVICE_VERSION); convivaPlugin.setDeviceInfo(deviceInfo); PlayerSDK.register(convivaPlugin); PlayerSDK.init(getApplicationContext()); } }setSettings(Map)
) and the system settings (seesetDeviceInfo(Map)
) before you register the plugin.- Since:
- 3.1.0
-
-
Constructor Summary
Constructors Constructor Description ConvivaPlugin(String convivaCustomerKey)
Create the plugin
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AnalyticsMetaData
createMetadata(boolean live, String assetId, String viewerId, Bundle bundle, Bundle customTags)
Create analytics metadata based on provided datastatic AnalyticsMetaData
createMetadata(Bundle bundle, AnalyticsMetaData analyticsMetaData, Bundle customTags)
Update provided analytics metadata with extra values from bundleString
getId()
void
init(Context context)
void
onRemotePlay(Bundle localConfiguration, JSONObject remoteConfiguration)
void
setDeviceInfo(Map<String,Object> deviceInfo)
Set the device infovoid
setEnabled(boolean enabled)
Enable or disable the pluginvoid
setSettings(Map<String,Object> settings)
Set the Conviva settings, used for debugging purposes
-
-
-
Constructor Detail
-
ConvivaPlugin
public ConvivaPlugin(@NonNull String convivaCustomerKey)
Create the plugin- Parameters:
convivaCustomerKey
- The Conviva customer key, should not be null
-
-
Method Detail
-
setSettings
public void setSettings(@NonNull Map<String,Object> settings)
Set the Conviva settings, used for debugging purposes Note: Make sure calling this method is done before you register the plugin, otherwise the settings might now have an effect- Parameters:
settings
- The settings
-
setDeviceInfo
public void setDeviceInfo(@NonNull Map<String,Object> deviceInfo)
Set the device info Note: Make sure calling this method is done before you register the plugin, otherwise the device info might now have an effect- Parameters:
deviceInfo
- The device info
-
setEnabled
public void setEnabled(boolean enabled)
Enable or disable the plugin- Parameters:
enabled
- true If the plugin is enabled and false otherwise
-
createMetadata
@NonNull public static AnalyticsMetaData createMetadata(boolean live, @NonNull String assetId, @Nullable String viewerId, @Nullable Bundle bundle, @Nullable Bundle customTags)
Create analytics metadata based on provided data- Parameters:
live
- true if the current content is a live stream and false otherwiseassetId
- The asset ID uniquely identifies the contentviewerId
- An identifier for the current User. Will override ConvivaSdkConstants.VIEWER_ID if not nullbundle
- Optional parameters. Custom tags should be in the following BundlecustomTags
- custom tags, or null- Returns:
- Created analytics metadata
-
createMetadata
@NonNull public static AnalyticsMetaData createMetadata(@NonNull Bundle bundle, @NonNull AnalyticsMetaData analyticsMetaData, @Nullable Bundle customTags)
Update provided analytics metadata with extra values from bundle- Parameters:
bundle
- The bundle where all extra values are setanalyticsMetaData
- Initial metadata to update with extra valuescustomTags
- custom tags, or null- Returns:
- Updated analytics metadata
-
onRemotePlay
public void onRemotePlay(@NonNull Bundle localConfiguration, @NonNull JSONObject remoteConfiguration)
- Overrides:
onRemotePlay
in classPlugin
-
-