Android Studio
(Android Studio) Admob 전면광고 넣기
SAFE
2016. 5. 20. 12:36
전면광고 넣기 - 이건 java만 있어도 가능.
==================
이걸 적용하려면 가장 먼저 해야할 게 있다..
이것 3, 4 실행
출처 : http://webnautes.tistory.com/661
===================
아래 필요한 부분에 소스 넣기
출처 :
https://developers.google.com/mobile-ads-sdk/docs/adx/android/interstitial#interstitialad
중간 내용
메인 액티비티 안에 저 코드를 맞춰서 넣으면 된다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | // 클래스 안에 쓰기. 굵게 표시한 부분 private InterstitialAd interstitial; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Create the interstitial. interstitial = new InterstitialAd(this); interstitial.setAdUnitId(" 애드몹 코드 ca-... 넣기 "); // Create ad request. AdRequest adRequest = new AdRequest.Builder().build(); // Begin loading your interstitial. interstitial.loadAd(adRequest); // start Ads interstitial.setAdListener(new AdListener() { public void onAdLoaded() { displayInterstitial(); } }); } // Invoke displayInterstitial() when you are ready to display an interstitial. public void displayInterstitial() { if (interstitial.isLoaded()) { interstitial.show(); } } | cs |
추가로 저걸 사용하려면?
출처 : http://stackoverflow.com/questions/20854789/admob-interstitial-ad-wont-display
1 2 3 4 5 6 | // start interstitial.setAdListener(new AdListener() { public void onAdLoaded() { displayInterstitial(); } }); | cs |