From Engineering Client Portal

Revision as of 07:29, 21 May 2017 by Admin (talk | contribs) (Created page with "{{Breadcrumb|}} {{Breadcrumb|Digital}} {{Breadcrumb|Android SDK API Reference}} {{CurrentBreadcrumb}} Category:Digital Category:Android SDK API Reference Use <code>upd...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Engineering Portal breadcrumbArrow.png Digital breadcrumbArrow.png Android SDK API Reference breadcrumbArrow.png updateOTT()
Use updateOTT method to notify App SDK that the remote OTT device (like Google ChromeCast, Roku, Amazon FireTV, etc.) is connected / disconnected (change of OTT status).

  • When OTT device is connected, call updateOTT with "ottStatus": "1" and a set of OTT device related parameters in ottInfo JSONObject.
  • When OTT device is disconnected, call updateOTT with "ottStatus": "0" in ottInfo JSONObject.


public void updateOTT(JSONObject ottInfo)

Input Parameters

Parameter Description
ottMetadata A JSON object with the following parameters

OTT device is connected

new JSONObject()
   .put("ottStatus": "1")
   .put("ottType": "casting")
   .put("ottDevice": "chromecast")
   .put("ottDeviceName": "Google ChromeCast")
   .put("ottDeviceID": "xxxx-xxxx-xxxx")
   .put("ottDeviceManufacturer": "Google")
   .put("ottDeviceModel": "ChromeCast")
   .put("ottDeviceVersion": "1.0.0");

OTT device is disconnected

new JSONObject()
   .put("ottStatus": "0")

See International Metadata (Germany).

Output Parameters

Output Parameters (Return value) Description


  • Every time when application is launched or moving to foreground, call updateOTT to report the current OTT status to the App SDK.
  • The application needs to report all the possible OTT types (casting, screen mirroring, and any other types) to App SDK.

Communicating with the Chromecast Receiver App

SDK cannot communicate directly with the Receiver App running on the Chromecast as it needs access to the Google Casting framework. Alternatively, App SDK requires the application to pass the data to the Receiver App. The application should:

  • Retrieve the Opt-Out status on the device (using getOptOutStatus()) and its Demographic ID (using getDemographicId())
  • Relay the retrieved details / values to the Receiver App, as additional parameters in MediaMetadata payload.
    • Create the metadata information for this purpose, using MediaMetadata.

The two custom parameters to be included in MediaMetadata are:

  • kGCKMetadataNlsKeyDeviceID for device ID.
  • kGCKMetadataNlsKeyOptout for Opt-out status (0 or 1).

Below is a sample code snippet on how the application should retrieve and relay the information from App SDK to Receiver App.

MediaMetadata mediaMetadata = new MediaMetadata( MediaMetadata.MEDIA_TYPE_MOVIE );
mediaMetadata.putString( MediaMetadata.KEY_TITLE, channelName.getText().toString());

//Custom parameters
mediaMetadata.putString( MEDIA_METADATA_KEY_DEVICE_ID, mAppSdk.getDemographicId() );
mediaMetadata.putString( MEDIA_METADATA_KEY_OPTOUT_STATE, mAppSdk.getOptOutStatus() ? 1:0);

MediaInfo mediaInfo = new MediaInfo.Builder(mNowPlayingUrl)
            .setContentType( getString( R.string.content_type_mp4 ) )
            .setStreamType( MediaInfo.STREAM_TYPE_BUFFERED )
            .setMetadata( mediaMetadata )