How to implement Reward video with Startapp

2.2k views Asked by At

Recently I'm facing issue related to Startapp platform for Android.

When I implemented the reward video it returns an error with:

FailledError execute Exception Error sendGetWithResponse code = [204]

Here is my function:

public void rewardAd() {
        Log.i("TAG", "Test");
  startAppAd.setVideoListener(new VideoListener() {

   @Override
   public void onVideoCompleted() {
    Log.i("TAG", "Grant User");
   }
  });

  startAppAd.loadAd(StartAppAd.AdMode.REWARDED_VIDEO, new AdEventListener() {
   @Override
   public void onReceiveAd(com.startapp.android.publish.adsCommon.Ad ad) {
    startAppAd.showAd();
   }

   @Override
   public void onFailedToReceiveAd(com.startapp.android.publish.adsCommon.Ad ad) {
    Log.i("TAG", "Failled"+ ad.getErrorMessage());
    startAppAd.showAd(new AdDisplayListener() {
     @Override
     public void adHidden(com.startapp.android.publish.adsCommon.Ad ad) {
      Log.i("TAG", "adHidden");
     }

     @Override
     public void adDisplayed(com.startapp.android.publish.adsCommon.Ad ad) {
      Log.i("TAG", "adDisplayed");
     }

     @Override
     public void adClicked(com.startapp.android.publish.adsCommon.Ad ad) {
      Log.i("TAG", "adClicked");
     }

     @Override
     public void adNotDisplayed(com.startapp.android.publish.adsCommon.Ad ad) {
      Log.i("TAG", "adNotDisplayed"+ ad.getErrorMessage());
     }
    });
    //startAppAd.showAd(getApplicationContext());
   }
  });
    }

Here is the logs that shows:

  • TAG: Test
  • TAG: FailledError execute Exception Error sendGetWithResponse code = [204]
  • TAG: adNotDisplayed

When I comment the function startAppAd.showAd(), and uncomment the last commented one startAppAd.showAd(), it's working fine.

This is the expected working scheme:

  1. Try to load a Video Reward Ad => startAppAd.loadAd();
  2. if failed (like my case) => onFailedToReceiveAd();
  3. Try to show an Ad that I can get listeners of it => startAppAd.showAd()

Thank You very much

1

There are 1 answers

0
abdello On

It's solved, the script itself is not bad and works fine, the problem was with Startapp they don't show a video ad because it doesn't exist any video to show.

Now if someone is facing the same problem i suggest to use a vpn on testing device with a country that startapp should have a video ad usually US.