AMP Android SDK: Adobe Heartbeat integration

Document created by Orlando Sanchez Martinez Employee on May 25, 2017Last modified by Orlando Sanchez Martinez Employee on May 25, 2017
Version 2Show Document
  • View in full screen mode

Prerequisite

The rest of this guide assumes you have successfully integrated AMP's Core (you are able to play back a video).
It also assumes you have started conversations with a Comscore representative, for them to provide you some custom metadata specific to your Android app, that you will need in Point #5 of this guide (AdobeUserId, TrackingServer, Publisher, Channel, Ovp).

Getting started

For reference, check the AMPHeartbeatSample Android Studio sample project in the release package.
To integrate the plugin into your app, you need to:

1) Add the following files to your project libraries:
adobeMobileLibrary.jar (provided by Adobe)

VideoHeartbeat.jar (provided by Adobe)
amp-analytics-adobe-heartbeat.jar (provided by Akamai)

 

2) In the Activity where playback is handled, import the following Java packages:

import com.adobe.primetime.va.plugins.videoplayer.AdInfo;
import com.adobe.primetime.va.plugins.videoplayer.QoSInfo;
import com.adobe.primetime.va.plugins.videoplayer.VideoInfo;
import com.akamai.analytics.adobeheartbeat.AdobeHeartbeatAnalyticsTracker;
import com.akamai.analytics.adobeheartbeat.delegates.HeartbeatDetails;
import com.akamai.config.data.HeartbeatConfigurationData;


3) Add an object of the AdobeHeartbeatAnalyticsTracker type in your Activity's members:

private AdobeHeartbeatAnalyticsTracker analytics;


4) Initialize that object, on the onResourceReady() method from the VideoPlayerContainerCallback:

private void initAnalytics() {
   analytics = new AdobeHeartbeatAnalyticsTracker(buildHeartbeatConfigurationData(),

                                              buildHeartbeatDetails());
   analytics.setVideoPlayerView(videoPlayerView);
   analytics.init(MainActivity.this);
}



5) The buildHeartbeatConfigurationData() method, returns a com.akamai.config.data.HeartbeatConfigurationData object. Check all it's set() methods, to send the appropriate values.
The com.akamai.analytics.adobeheartbeat.delegates.HeartbeatDetails is composed of the following:

  • import com.adobe.primetime.va.plugins.videoplayer.VideoInfo;
  • import com.adobe.primetime.va.plugins.videoplayer.AdInfo;
  • import com.adobe.primetime.va.plugins.videoplayer.QoSInfo;


5.1) Alternatively, you can provide this data as an AMP Config file.

videoPlayerContainer.setConfig(HEARTBEAT_CONFIG);


When creating the AdobeHeartbeatAnalyticsTracker, use the empty constructor (the HeartbeatConfigurationData and HeartbeatDetails will be constructed automatically from the .json configuration file).

 

6) If your app integrates ads, it should use the corresponding AMP Plugin for integration with Heartbeat. This example assumes Google IMA Ads.
Once the com.akamai.ima.AdsComponent is initialized, it has to send the different events to AMP's Nielsen object:

adsComponent.addEventsListener(streamsenseAnalytics);

 

7) Reach out to an Adobe representative to get certified.
Please add amp-sdk-support@akamai.com to that email thread, so we can be in the loop.

Attachments

    Outcomes