Monetization Features

For a more complete overview of the Monetization features please refer to the dedicated section Monetization Features.

As described in "Call the SDK", you first need to initialize the SDK:

  // 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 API key here!
  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);

  // Start activity

  @Override
  protected void onStart() {
    super.onStart();
    m_adSdk.onStart (this);
  }

  // Stop activity

  @Override
  protected void onStop() {
    m_adSdk.onStop();
    super.onStop();
  }
Warning: do not forget to remove the Debug Mode when you distribute your app.

Now, in your activity onCreate(), call the prepare() method to tell the SDK to start loading ads.

  // Create activity

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Initialize SDK
        m_adSdk.prepare(this);
    }

That's it, the SDK will initialize and manage sessions, and you are ready to start displaying ads.