0

I'm looking for a way to preload RevMob Banner and Interstitial ads within my android app? The ads can take anything from 5-30 seconds at the moment, which is way to long for the type of app.

Any help is appreciated.

Jele
  • 215
  • 1
  • 2
  • 11

3 Answers3

1

If you use the ad object you can do a preload (RevMob API Docs) and show like this:

Fullscreen fullscreen = revmob.createFullscreen(this);
if (fullscreen.isAdLoaded()) {
  fullscreen.show();
}

But the show only will work if the ad is already loaded!

Diogo T
  • 2,591
  • 1
  • 29
  • 39
0

In the newest versions there are some important changes. You must use the "isAdLoaded" only if you are implementing some mediation strategy. Otherwise, you can use directly the "show" and "hide" method.

RevMob revmob = RevMob.start(this, APPLICATION_ID);    
RevMobFullscreen fullscreen = revmob.createFullscreen(this);
// it will show the ad. If it is not loaded yet, it will show it after it is completely loaded automatically.
fullscreen.show();
// If you change your scene and you do not want to show the ad anymore, you can call this method:
fullscreen.hide();

http://sdk.revmob.com/android-api/index.html

Paulo Cheque
  • 2,797
  • 21
  • 22
0

Add to AndrodMainfest.xml file

      <uses-permission android:name="android.permission.INTERNET" />
      <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
       <uses-permission android:name="android.permission.READ_PHONE_STATE" />
      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
          <activity
        android:name="com.revmob.ads.fullscreen.FullscreenActivity"
        android:configChanges="keyboardHidden|orientation" >
    </activity>

// private RevMobFullscreen fullscreen;

   private static final String REVMOB_APP_ID = "rebmob_id";
 private RevMob revmob;
 RevMobAdsListener revmobListener;
                @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    onStart();
    // Starting RevMob session
    revmob = RevMob.start(this, REVMOB_APP_ID);
    revmob.printEnvironmentInformation(this);

    revmob.setTestingMode(RevMobTestingMode.WITH_ADS); // with this line,
                                                        // RevMob will
                                                        // always deliver a
                                                        // sample ad
    // revmob.setTestingMode(RevMobTestingMode.WITHOUT_ADS);
    // revmob.createFullscreen(this, revmobListener);
    //
    revmob.showFullscreen(this);
    revmob.setTimeoutInSeconds(5);
           }

metho call

   public void onStart() {
       super.onStart();
         revmobListener = new RevMobAdsListener() {
        @Override
        public void onRevMobAdDisplayed() {
            Log.i("[RevMob]", "onAdDisplayed");
        }

        @Override
        public void onRevMobAdReceived() {
            Log.i("[RevMob]", "onAdReceived");
        }

        @Override
        public void onRevMobAdNotReceived(String message) {
            Log.i("[RevMob]", "onAdNotReceived");
        }

        @Override
        public void onRevMobAdDismiss() {
            Log.i("[RevMob]", "onAdDismiss");
        }

        @Override
        public void onRevMobAdClicked() {
            Log.i("[RevMob]", "onAdClicked");
        }
    };
   }

   public void showFullscreen(View view) {
        RevMobFullscreen fs = revmob.createFullscreen(this, revmobListener);
    fs.show();
   }

    public void revMobOpenPopup(View view) {
    // revmob.showPopup(this);
    RevMobPopup popup = revmob.createPopup(this, revmobListener);
    popup.show();
}
Rishi Gautam
  • 1,948
  • 3
  • 21
  • 31