Template

Initialization of App SDK object through a JSON object: Difference between revisions

From Engineering Client Portal

(Created page with "====Initialization of App SDK object through a JSON object==== <syntaxhighlight lang="objective-c"> JSONObject config = null; try { // Prepare AppSdk configuration object...")
 
 
Line 14: Line 14:
           .put("uid2", "MTKVpUAzwYAPnHrtfE0wlINOMzhU7UUEjjVdCdRu63k=")
           .put("uid2", "MTKVpUAzwYAPnHrtfE0wlINOMzhU7UUEjjVdCdRu63k=")
           .put("uid2_token", "AgAAAAPFR0zA5ogv/yaAPiUsAdZPsfqS8QlDSGxAB+rr8yekFs3AjLYVk5qqqiyV2XHbSuwzHmxSlLeQeKQI1mp015jsNnpX5/xGgXldcgVz+gFnyh3T8/3agMwRmyrhCxG4oH2C7fc48AQk2eotE7FW0ZDEYM8fD9ZxDaxFUC/OV3OuZA==")
           .put("uid2_token", "AgAAAAPFR0zA5ogv/yaAPiUsAdZPsfqS8QlDSGxAB+rr8yekFs3AjLYVk5qqqiyV2XHbSuwzHmxSlLeQeKQI1mp015jsNnpX5/xGgXldcgVz+gFnyh3T8/3agMwRmyrhCxG4oH2C7fc48AQk2eotE7FW0ZDEYM8fD9ZxDaxFUC/OV3OuZA==")
           .put("hem_sha256", "tMmiiTI7IaAcPpQPFQ65uMVCWH8av9jw4cwf/F5HVRQ=")
           .put("hem_sha256", "e46f3f2c8c0e1d509aeb04d2fd78f0481c8520cb6769c258a50ddb98b073dabc")
           .put("hem_sha1", "")
           .put("hem_sha1", "")
           .put("hem_md5", "");
           .put("hem_md5", "");

Latest revision as of 19:43, 7 August 2023

Initialization of App SDK object through a JSON object

JSONObject config = null;
 
try
{
  // Prepare AppSdk configuration object (JSONObject)
  JSONObject appSdkConfig = new JSONObject()
          .put("appid", "PXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")
          .put("sfcode", "dcr")
          .put("nol_devDebug", "INFO") // only for debug builds
          .put("custom_key1", "custom_value1")
          .put("custom_key2", "custom_value2")
          .put("uid2", "MTKVpUAzwYAPnHrtfE0wlINOMzhU7UUEjjVdCdRu63k=")
          .put("uid2_token", "AgAAAAPFR0zA5ogv/yaAPiUsAdZPsfqS8QlDSGxAB+rr8yekFs3AjLYVk5qqqiyV2XHbSuwzHmxSlLeQeKQI1mp015jsNnpX5/xGgXldcgVz+gFnyh3T8/3agMwRmyrhCxG4oH2C7fc48AQk2eotE7FW0ZDEYM8fD9ZxDaxFUC/OV3OuZA==")
          .put("hem_sha256", "e46f3f2c8c0e1d509aeb04d2fd78f0481c8520cb6769c258a50ddb98b073dabc")
          .put("hem_sha1", "")
          .put("hem_md5", "");
// Pass appSdkConfig to the AppSdk constructor
mAppSdk = new AppSdk(appContext, appSdkConfig, appSdkListener);
}
catch (JSONException e)
{
  Log.e(TAG, "Couldn’t prepare JSONObject for appSdkConfig", e);
}

Here, appContext is the App context object and appSdkConfig is JSON object for holding the parameters (appid, sfcode) the App passes to the Nielsen App SDK via a JSON string. The appid is obtained from Nielsen operational support and is unique to the app.