Adding the Android SDK

Adding the Android SDK to your Eclipse project is fast and simple. Just follow these steps and you’ll be up and running.

Add the Android compatibility libraries

  1. Download the Android Support Library revision 12 or newer.
  2. Add the support library to your Eclipse project. See Support Library Setup.

Add the Medio SDK

  1. Download the Medio Android SDK.
  2. Add the Medio SDK JAR file to the libs directory of your Eclipse project. See Adding an External Library (.jar) using Eclipse.

Modify your manifest

Add the android.permission.INTERNET permission to your AndroidManifest.xml file:

<uses-permission android:name="android.permission.INTERNET"/>

Add the code

The SDK must be properly configured before use. Usually, this means that you should call EventAPI.configure on creation of every activity. Note that we’ll provide you with an API key for your app when you sign up with Medio. To properly track usage information, EventAPI.openSession and EventAPI.closeSession should be called as well in onStart and onStop respectively. All of this is most easily accomplished by using a common base activity class from which all your activities derive containing something like the following:

public class BaseActivity extends Activity {
    public void onCreate(Bundle savedInstanceState) {
        EventAPI.configure(this, API_KEY);

    protected void onStart() {

    protected void onStop() {

Advanced usage

Activities are the most common, but not the only entry points into an application. If you have a service that uses the SDK, you will need to configure it at the creation of the service as well. Direct use of the SDK inside broadcast receivers is discouraged. Alternatively, instead of configuring the SDK in each entry point, you could configure it in the onCreate method of a custom Application class. This also requires a change to the manifest to use this custom application class.