사용자가 주 활동에서 뒤로 버튼을 누르면 애플리케이션의 끝에 admob 삽입 광고를 표시하려고합니다. 광고는 표시되지만 광고는 클릭 할 수 없습니다.Admob android app exit에서 삽입 광고를 클릭 할 수 없습니다.
interstitial = new InterstitialAd(getApplicationContext());
interstitial.setAdUnitId("Ad UNIT ID");
// Create ad request.
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();
// Begin loading your interstitial.
interstitial.loadAd(adRequest);
및 OnBackPressed에 :
@Override
public void onBackPressed() {
super.onBackPressed();
displayInterstitial();
}
protected void displayInterstitial() {
Log.d(TAG, "start displayInterstitial()");
if (null != interstitial && interstitial.isLoaded()) {
Log.d(TAG, "displayInterstitial() loaded");
interstitial.show();
}
Log.d(TAG, "end displayInterstitial()");
}
사람이이 문제를 해결하는 데 도움 주실 래요 내 코드
내가 활동에서 onCreate에서 일부를로드 넣어입니까?
문제는 'displayInterstitial()'전에 'super.onBackPressed'를 호출하는 것일 수 있습니다. AdListener를 구현하고 대신 onAdClosed에서 super.onBackPressed를 호출하십시오. 또는 displayInterstitial이 작동 한 후에 super.onBackPressed를 호출하면 실제로 시도 할 수 있습니다. – donfuxx
displayInterstitial() 후에 super.onBackPressed를 호출해도 도움이되지 않았습니다. onBackPressed 수퍼 클래스 메서드와 연결되어 있기 때문에 superListener는 onLoadPressed를 호출 할 수 없습니다. – venkat
AdListener 내부에서 이렇게하는 것이 좋습니다 :'MainActivity.super.onBackPressed(); ' – donfuxx