2013-07-10 2 views
2
나는 안드로이드 응용 프로그램을 개발하고 사용자가 버튼을 다시 누르면 응용 프로그램을 종료 할 때 MoPub에서에게 간질 전체 화면 광고가 게재하고자

을 다시 클릭하면 응용 프로그램을 종료 삽입 광고.안드로이드 : 쇼 MoPub에서 사용자가 버튼

삽입 광고를 만들고 onDestroy 메소드에 표시하려고했습니다. 뭐 그런 그러나

@Override 
public void onDestroy(){ 
    this.interstitial = new MoPubInterstitial(this, MY_INTERSTITIAL_AD_UNIT_ID_HERE); 
    this.interstitial.setInterstitialAdListener(this); 
    this.interstitial.load(); 

    super.onDestroy(); 
} 

// InterstitialAdListener method 
@Override 
public void onInterstitialLoaded(MoPubInterstitial interstitial) { 
    if (interstitial.isReady()) { 
     mInterstitial.show(); 
    } else { 
     // Other code 
    } 
} 

, 난 아무 간질을 파괴하고 있지 않다 (mInterstitial.destroy();) 내가 그것을 할 수 있기 때문에 나는이 오류가 무엇입니까 어디 있는지 알고하지 않기 때문에 :

을 나는이 오류를 얻고 있지만
Activity com.myActivity has leaked IntentReceiver [email protected] that was originally registered here. Are you missing a call to unregisterReceiver()? 
android.app.IntentReceiverLeaked: Activity com.myActivity has leaked IntentReceiver [email protected] that was originally registered here. Are you missing a call to unregisterReceiver()? 

, 추가 기능이 표시됩니다 (나는 많은 장치에서 테스트 한)과는 소니를 제외하고 모두에서 잘 작동 보인다.

이탈시 삽입 광고를 표시하려면 어떻게해야합니까?

감사합니다.

답변

2

마지막으로, 사용자가 자연적인 방법으로 응용 프로그램을 종료 할 때 나를 MoPub에서 전체 화면 광고를 게재 할 수 Postitial라는 새로운 광고 기술을 발견했다. 당신이 대신 onBackPressed 방법을 오버로드를 시도 할 수 있습니다 mopubview에게

if (mMoPubView!=null) { 
     mMoPubView.destroy(); 
    } 
1

당신은 온전한 동안 삽입 광고를로드합니다. interstitialload 이후에 활동이 파손되면 누출됩니다. ondestroy에서 interstitial.destroy()를 호출하십시오.

아마도 당신은 onbackpressed를 처리하고 싶을 것입니다. interstitial oncreate를로드하고 onbackpressed로 표시하고 ondestroy로 삭제합니다.

+0

제가 사용한 솔루션에 대한 질문에 대답했지만 어쩌면 당신의 대답도 유효 할 수 있습니다. 고맙습니다. – ljmelgui

0

(: 당신은 여기에서 자세한 내용을 볼 수 있습니다. 이렇게하면 onDestroy를 사용하여 삽입 광고를 정리할 수 있습니다.

틈새가 반환 액티비티 리스너 호출 마감 후

@Override 
public void onBackPressed(){ 
    if (interstitial.isReady()) { 
     interstitial.show(); //this will show the interstitial if it's ready 
    } else { 
     super.onBackPressed(); //this will exit the program 
    } 
} 

()에서

(실패 할 때 또는 닫기) 물론

@Override 
public void onInterstitialFailed(MoPubInterstitial interstitial, MoPubErrorCode errorCode) { 
    finish(); //this will exit the program if interstitial fail to load. 
} 

@Override 
public void onInterstitialDismissed(MoPubInterstitial interstitial) { 
    finish(); //this will exit the program if interstitial is closed 
} 

여전히으로 파괴 호출 할 필요가 정상 당.

@Override 
protected void onDestroy() { 
    interstitial.destroy(); 
    super.onDestroy(); 
} 
1

이전 게시물 그러나이 문제를 찾고 있었고이 게시물을 발견했습니다. 당신이 가까운 활동을 원하고 간질을 보여 경우에 대한 오류를 가지고있는 경우

이제 "활동이 누출 된 창", onAdClosed에() 마무리를 넣어 기억하고 다른 곳

mInterstitialAd.setAdListener(new AdListener() { 
      @Override 
      public void onAdClosed() { 
       finish(); 
       requestNewInterstitial(); 

      } 
     }); 

이.

0

100 % 작업 솔루션인데, 우리는 삽입 광고와 배너 광고 모두에 대해 파괴 기능을 호출해야합니다.

@Override 
    protected void onDestroy() { 

     if(mopubInterstitial != null){ 
      mopubInterstitial.destroy(); 
     } 
     if (mopubBannerPubView != null){ 
      mopubBannerPubView.destroy(); 
     } 
     super.onDestroy(); 
    }