Dash Stats Docs

Getting started

Integrate the AppBrain SDK in your app in 5 minutes, using these four simple steps:

1. Add Gradle dependency

In your project’s build.gradle file add:

repositories {
    maven {
        url 'http://swisscodemonkeys.github.io/appbrain-sdk/maven'
    }
}

dependencies {
    compile 'com.appbrain:appbrain-sdk:[email protected]'
}

2. Initialize the SDK

In each Activity that uses the AppBrain SDK, call AppBrain.init():

import com.appbrain.AppBrain;

public class ExampleActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        AppBrain.init(this);
    }
}

3. Show ads

Show an interstitial ad with InterstitialBuilder, for example when the user leaves your app:

private InterstitialBuilder interstitialBuilder;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    interstitialBuilder = InterstitialBuilder.create().setAdId(AdId.EXIT)
        .setFinishOnExit(this).preload(this);
}

@Override
public void onBackPressed() {
    if (getFragmentManager().getBackStackEntryCount() > 0
        || !interstitialBuilder.show(this)) {
        super.onBackPressed();
    }
}

For more details and examples, see Ad unit overview.

4. Access your account

If you haven’t done so yet, create an AppBrain developer account to get access to the AppBrain developer dashboard and to register your app for the SDK.

You’re done! For more detailed instructions see SDK setup, or the rest of the AppBrain SDK help pages.