Call the SDK

In your Java activity code, import the Appsfire Ad SDK classes:

import com.appsfire.adUnitJAR.sdk.*;
import com.appsfire.adUnitJAR.sdk.AFAdSDK.*;
import com.appsfire.adUnitJAR.sdkimpl.AFSDKFactory;
import com.appsfire.adUnitJAR.exceptions.*;

In your activity, create an instance of the Ad SDK with your API key:

    // True for debug mode, false for production mode (set to false when distributing your app)
    private static final Boolean IS_AFADSDK_DEBUG = true;

    // Put your app ID here, as provided by Appsfire!
    private static final String YOUR_APP_ID = "MY_APP_ID_HERE";

    // Create instance of the Appsfire Ad SDK
    private static AFAdSDK m_adSdk = AFSDKFactory.getAFAdSDK().setAppId(YOUR_APP_ID).setDebugModeEnabled(IS_AFADSDK_DEBUG);
Warning: do not forget to remove the Debug Mode when you distribute your app.

In your activity's onStart() and onStop(), call the ad SDK so that it can manage sessions:

    // Start activity

    protected void onStart() {
        m_adSdk.onStart (this);

    // Stop activity

    protected void onStop() {
        m_adSdk.onStop ();