AirPush trouble implementing SDK

Discussion in 'Help & Support' started by Joshua, Oct 3, 2013.

  1. Joshua Seasoned Vet

    Member Since:
    Jul 12, 2013
    Message Count:
    116
    Likes Received:
    16
    Trophy Points:
    100
    I know how to implement the required declarations and the required permissions but when it comes to implementing the actually advertising code I an issue arises. If there is anyone familiar with how to implement the banner/interstitial ads into the splash and settings menu it would be awesome.

    Here is the code.

    Step 3 - Editing Your Main File

    Inside "Activity," please add:
    AirPlay airPlay=new AirPlay(this, null, false);
    Example:
    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Toast;

    import com.pfadmilb.xghtkgqz156374.AdCallbackListener; //Add import statements
    import com.pfadmilb.xghtkgqz156374.AirPlay;

    public class MainActivity extends Activity{
    private AirPlay airPlay; //Declare AirPlay here
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ad);
    if(airPlay==null)
    airPlay=new AirPlay(activity, adCallbackListener, false);
    }

    Parameters
    1. Activity activity
    2. AdCallbackListener adCallbackListener
    3. boolean enablecaching This parameter will enable caching for SmartWall Ads. When you will use a SmartWall ad call it cached the ad locally. To show the ad you need to call airPlay.showCachedAd(this, adType);.
    Caching

    This is a new feature which we have added it in this version for better user experience. You can cache an ad before displaying it to user. To enable cache pass the third parameter as true as mentioned above.
    Example

    if(airPlay==null)
    airPlay=new AirPlay(activity, adCallbackListener, true); // ad caching is enabled

    airPlay.startAppWall(); //this will start the AppWall ad but it will not show you AppWall instantly.

    @Override
    public void onAdCached(AdType adType) {

    //you will receive the information here if an ad is cached.

    }
    //now you can show the AppWall ad at any place within your app. You need to use the following method:

    airPlay.showCachedAd(this, AdType.appwall);



    Note: You can use caching for Smartwall ad formats. Please use the above mentioned steps for caching;
    Using SmartWall in your application:

    Airpush’s SmartWall is comprised of the following five sub Ad Formats:
    1. Dialog Overlay Ad
    2. AppWall Ad
    3. Landing Page Ad
    4. Rich Media Interstitial Ad
    5. Video Ad

    Airpush’s ad server determines and displays the best sub-ad-format to maximize your revenue from Interstitial Ad Placements in your application. You just have to call the “airPlay.startSmartWallAd()” method wherever you want to show Airpush’s Smartwall. For example: in the case of a gaming app, you can call "airPlay.startSmartWallAd()" between different levels and show a SmartWall app after a user clears each level. Airpush also offer flexibility for developers to choose a specific sub-ad-format from the above options to display by using the following methods within your code:
    1. To start Overlay Dialog Ad: airPlay.startOverlayAd();
    2. To start AppWall Ad: airPlay.startAppWall();
    3. To start Landing Page Ad: airPlay.startLandingPageAd();
    4. To start Rich Media Interstitial Ad: airPlay.showRichMediaInterstitialAd();
    5. To start Video Ad: airPlay.startVideoAd();
    Note: Although developers can choose to display a specific sub-ad-format, we highly recommend using the “airPlay.startSmartWallAd()” method which lets the Airpush ad server decide the best sub-format in order to maximize your earnings. We would also recommend showing Smartwall on App Launch and App Exit to maximize monetization. Here's sample code for showing Airpush’s Smartwall on app exit:
    If you want to show a SmartWall ad where the sub-format will be determined by SDK, please use the code below:
    @Override
    public void onBackPressed() {
    if (airPlay!=null) {
    airPlay.startSmartWallAd();
    }
    super.onBackPressed();
    }

    For individual calls, use the below code:
    @Override
    public void onBackPressed() {
    if (airPlay!=null) {
    //Use only one from below.
    airPlay.startAppWall();
    airPlay.startOverlayAd();
    airPlay.startVideoAd();
    airPlay.startLandingPageAd();
    airPlay.showRichMediaInterstitialAd();
    }
    super.onBackPressed();
    }

    Note: This code can be used in the Activity file only.
    If your application supports Android version 2.0 or below, please initialize the SDK as shown below:
    if(android.os.Build.VERSION.SDK_INT >=7){
    AirPlay airPlay=new AirPlay(this, null, true);
    airPlay.startSmartWallAd(); //start smartwall ad.
    }

    4. AdCallbackListener:

    In this SDK version we've added callback listeners for all ads, which can be called using the code below:
    private AirPlay airPlay; //Declare Airpush here
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ad);
    if(airPlay==null)
    airPlay=new AirPlay(this, adCallbackListener, true);

    }

    AdCallbackListener adCallbackListener=new AdCallbackListener() {

    @Override
    public void onSDKIntegrationError(String message) {
    //Here you will receive message from SDK if it detects any integration issue.
    }

    public void onSmartWallAdShowing() {
    // This will be called by SDK when it’s showing any of the SmartWall ad.
    }

    @Override
    public void onSmartWallAdClosed() {
    // This will be called by SDK when the SmartWall ad is closed.
    }

    @Override
    public void onAdError(String message) {
    //This will get called if any error occurred during ad serving.
    }
    @Override
    public void onAdCached(AdType arg0) {
    //This will get called when an ad is cached.

    }

    };
    Here is the link for any further information.

    http://manage.airpush.com/docs/index.php?title=AirSDK_1.0_for_Play_Store_DocumentationPlease help me someone..

Share This Page