Learn how to set up the Streaming Media Collection for Android devices.
With the end of support for Version 4 Mobile SDKs on August 31, 2021, Adobe will also end support for the Media Analytics SDK for iOS and Android. For additional information, see Media Analytics SDK End-of-Support FAQs.
Obtain valid configuration parameters for the Media SDK
These parameters can be obtained from an Adobe representative after you set up your analytics account.
Implement ADBMobile for Android in your application
For more information about the Adobe Mobile SDK documentation, see Android SDK 4.x for Experience Cloud Solutions.
Provide the following capabilities in your media player:
Add your downloaded Media SDK to your project.
Expand the Android zip file (e.g., MediaSDK-android-v2.*.zip
).
Verify that the MediaSDK.jar
file exists in the libs/
directory.
Add the library to your project.
IntelliJ IDEA:
Right click your project in the Project navigation panel.
Select Open Module Settings.
Under Project Settings, select Libraries.
Click + to add a new library.
Select Java and navigate to the MediaSDK.jar
file.
Select the modules in which you plan to use the mobile library.
Click Apply and then OK to close the Module Settings window.
Eclipse:
In the Eclipse IDE, right-click on the project name.
Click Build Path > Add External Archives .
Select MediaSDK.jar
.
Click Open.
Right-click the project again, and click Build Path > Configure Build Path .
Click the Order and Export tabs.
Ensure that the MediaSDK.jar
file is selected.
Import the library.
import com.adobe.primetime.va.simple.MediaHeartbeat;
import com.adobe.primetime.va.simple.MediaHeartbeat.MediaHeartbeatDelegate;
import com.adobe.primetime.va.simple.MediaHeartbeatConfig;
import com.adobe.primetime.va.simple.MediaObject;
Create the MediaHeartbeatConfig
instance.
Here is a sample MediaHeartbeatConfig
initialization:
// Media Heartbeat Initialization
config.trackingServer = _<SAMPLE_HEARTBEAT_TRACKING_SERVER>_;
config.channel = <SAMPLE_HEARTBEAT_CHANNEL>;
config.appVersion = <SAMPLE_HEARTBEAT_SDK_VERSION>;
config.ovp = <SAMPLE_HEARTBEAT_OVP_NAME>;
config.playerName = <SAMPLE_PLAYER_NAME>;
config.ssl = <true/false>;
config.debugLogging = <true/false>;
Implement the MediaHeartbeatDelegate
interface.
public class VideoAnalyticsProvider implements Observer, MediaHeartbeatDelegate{}
// Replace <bitrate>, <startupTime>, <fps>, and
// <droppeFrames> with the current playback QoS values.
@Override
public MediaObject getQoSObject() {
return MediaHeartbeat.createQoSObject(<bitrate>,
<startupTime>,
<fps>,
<droppedFrames>);
}
//Replace <currentPlaybackTime> with the video player current playback time
@Override
public Double getCurrentPlaybackTime() {
return <currentPlaybackTime>;
}
Create the MediaHeartbeat
instance.
Use the MediaHeartbeatConfig
instance and the MediaHertbeatDelegate
instance to create the MediaHeartbeat
instance.
// Replace <MediaHertbeatDelegate> with your delegate instance
MediaHeartbeat _heartbeat =
new MediaHeartbeat(<MediaHeartbeatDelegate>, config);
Make sure that your MediaHeartbeat
instance is accessible and does not get deallocated until the end of the session. This instance will be used for all of the following tracking events.
Adding app permissions
Your app using the Media SDK requires the following permissions to send data in tracking calls:
INTERNET
ACCESS_NETWORK_STATE
To add these permissions, add the following lines to your AndroidManifest.xml
file in the application project directory:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Migrating from version 1.x to 2.x in Android
In versions 2.x, all of the public methods are consolidated into the com.adobe.primetime.va.simple.MediaHeartbeat
class to make it easier on developers. Also, all configs are now consolidated into the com.adobe.primetime.va.simple.MediaHeartbeatConfig
class.
For information about migrating from 1.x to 2.x, see the Legacy Implementation documentation.