2014-04-17 6 views
0

안녕하세요. AdColony SDK에서 두 개 이상의 동영상을 순서대로 실행하고 싶습니다. 하나의 동영상이 끝나면 다른 동영상이 표시되어야합니다. 그러나 그것을 작동시킬 수 없다. 하나는 첫 번째 비디오가 끝나고 다른 비디오는 보이지 않는다. 이 내 코드 내에서 onCreate 방법 :AdColony에서 두 개 이상의 동영상을 연속적으로 실행합니다.

@Override 
    public void onCreate(Bundle savedInstanceState) 
    { 
    super.onCreate(savedInstanceState); 
    getActionBar().hide(); 
    // Configure ADC once early before any other ADC calls (except setCustomID/setDeviceID). 
    AdColony.configure(this, "1.0", APP_ID, ZONE_ID_ONE_VIDEO); 
    // version - arbitrary application version 
    // store - google or amazon 

    // Disable rotation if not on a tablet-sized device (note: not 
    // necessary to use AdColony). 
    if (!AdColony.isTablet()) 
    { 
     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); 
    } 

    // Notify this object about confirmed virtual currency. 
    AdColony.addV4VCListener(this); 

    // Notify this object about ad availability changes. 
    AdColony.addAdAvailabilityListener(this); 

    setContentView(R.layout.videos_ads_activity); 

    mAppPreferences = new AppPreferences(this); 

    /*video1 = new AdColonyV4VCAd(WatchVideosActivity.ZONE_ID_ONE_VIDEO); 
    video2 = new AdColonyV4VCAd(WatchVideosActivity.ZONES_FIVES_VIDEOS[1]).withListener(this); 
    video3 = new AdColonyV4VCAd(WatchVideosActivity.ZONES_FIVES_VIDEOS[2]).withListener(this); 
    video4 = new AdColonyV4VCAd(WatchVideosActivity.ZONES_FIVES_VIDEOS[3]).withListener(this); 
    video5 = new AdColonyV4VCAd(WatchVideosActivity.ZONES_FIVES_VIDEOS[4]).withListener(this);*/ 


    showOneVideo = (Button) findViewById(R.id.buttonShowOneVideo); 
    showOneVideo.setOnClickListener(
      new View.OnClickListener() 
      { 
       public void onClick(View v) 
       { 
        AdColonyV4VCAd v4vc_ad = new AdColonyV4VCAd() 
        .withListener(WatchVideosActivity.this); 

        if(v4vc_ad.getAvailableViews() == 0){ 
         Toast.makeText(WatchVideosActivity.this, "Loading ads", Toast.LENGTH_SHORT).show(); 
        }else{ 
         v4vc_ad.show(); 
        } 
       } 
      }); 

    showFiveVideos = (Button) findViewById(R.id.buttonShowFiveVideos); 
    showFiveVideos.setOnClickListener(
      new View.OnClickListener() 
      { 
       public void onClick(View v) 
       { 
        v4vc_ad = new AdColonyV4VCAd(ZONE_ID_ONE_VIDEO) 
        .withListener(WatchVideosActivity.this); 

        if(v4vc_ad.getAvailableViews() == 0){ 
         Toast.makeText(WatchVideosActivity.this, "Loading ads", Toast.LENGTH_SHORT).show(); 
        }else{ 
         v4vc_ad.show(); 
        } 
       } 
      }); 
} 

내 클래스의 나머지 (내가 인스턴스 변수를 넣지 마십시오하지만이 선언되고) :

 public void onPause() 
    { 
    super.onPause(); 
    AdColony.pause(); 
    } 

    public void onResume() 
    { 
    super.onResume(); 
    AdColony.resume(this); 
    } 

    // Reward Callback 
    public void onAdColonyV4VCReward(AdColonyV4VCReward reward) 
    { 
    if (reward.success()) 
    { 
     //Guardamos el reward en mi preference 
     mAppPreferences.setCoins(mAppPreferences.getCoins() + reward.amount()); 
     Log.d("AdColony", "rewaerdCallback listener"); 
    } 
    } 

    // Ad Started Callback - called only when an ad successfully starts playing 
    public void onAdColonyAdStarted(AdColonyAd ad) 
    { 
    Log.d("AdColony", "onAdColonyAdStarted"); 
    } 

    //Ad Attempt Finished Callback - called at the end of any ad attempt - successful or not. 
    public void onAdColonyAdAttemptFinished(AdColonyAd ad) 
    { 

      try { 
       Thread.sleep(1500); 
      } catch (InterruptedException e) { 
       // TODO Auto-generated catch block 
       e.printStackTrace(); 
      } 

     AdColonyV4VCAd v4vc_ad = new AdColonyV4VCAd() 
     .withListener(WatchVideosActivity.this); 

     v4vc_ad.show(); 
     } 
    } 

내가 새로운 비디오를 만들 onAdColonyAdAttemptFinished 콜백이 표시되지 않습니다. 도와주세요. 미리 감사드립니다.

답변

2

새 AdColony 비디오 광고는 onAdColonyAdAttemptFinished 콜백 이후에 준비 될 것입니다. 또한이 수준의 광고 가용성을 항상 보장 할 수있는 방법이 없기 때문에 이러한 방식으로 5 개의 동영상을 표시하는 버튼이있는 아이디어는 권장되지 않습니다.

말했다되고 그건,이에 대한 가능한 해결 방법은 핸들러 등 같은 Runnable를 사용하는 것입니다 :)에 Thread.sleep를 (필요도 없다

//In your onCreate method w/ the variables declared globally 
handler = new Handler(); 
runnable = new Runnable() 
{ 
    public void run() 
    { 
    AdColonyV4VCAd ad = new AdColonyV4VCAd(ZONE_ID).withListener(listener); 
    ad.show(); 
    } 
}; 

... 
... 
... 

//At the end of your onAdColonyAdAttemptFinished method, 
//delay a second or so to allow your Activity to regain 
//control before attempting to launch the new advertisement. 
handler.postDelayed(runnable, 1000); 

이 솔루션을 당신 현재 포함했다. 다른 문의 사항은 [email protected]으로 직접 문의하십시오.

+0

다른 액티비티 인 Forward 또는 Backwark로 옮길 때 Interstial AdColony 광고가 한 번 실행됩니다. 내 interstials 광고에 이유가 표시되지 않습니다. – Nepster

관련 문제