전면광고 테스트로 만들었는데, test-unit-id 로 할시에는 테스트 광고가 나오는데,
이것을 실제 unit-id를 넣은 후에 배포하면, 안나오네요.
ad 가 로딩이 안됫다고 나와요ㅠㅠ
스크린샷하고 코드 보여드릴테니 제발 도와주세요 ㅠㅠ
아래 튜토리얼 보고 똑같이 만든 코드입니다.
https://developers.google.com/admob/android/interstitial
그리고 아래는 저의 admob 캡쳐 화면입니다.


아래는 저의 코드입니다.
1. mainactivity.java
package admobtest.com.theaterwin.theateradmobtest;
public class MainActivity extends AppCompatActivity {
private static final long GAME_LENGTH_MILLISECONDS = 3000;
private InterstitialAd interstitialAd;
private CountDownTimer countDownTimer;
private Button retryButton;
private boolean gameIsInProgress;
private long timerMilliseconds;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Initialize the Mobile Ads SDK.
MobileAds.initialize(this, "ca-app-pub-4942856506050335~1501960845");
// Create the InterstitialAd and set the adUnitId.
interstitialAd = new InterstitialAd(this);
// Defined in res/values/strings.xml
interstitialAd.setAdUnitId(getString(R.string.ad_unit_id));
interstitialAd.setAdListener(new AdListener() {
@Override
public void onAdClosed() {
startGame();
}
});
// Create the "retry" button, which tries to show an interstitial between game plays.
retryButton = findViewById(R.id.retry_button);
retryButton.setVisibility(View.INVISIBLE);
retryButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showInterstitial();
}
});
startGame();
}
private void createTimer(final long milliseconds) {
// Create the game timer, which counts down to the end of the level
// and shows the "retry" button.
if (countDownTimer != null) {
countDownTimer.cancel();
}
final TextView textView = findViewById(R.id.timer);
countDownTimer = new CountDownTimer(milliseconds, 50) {
@Override
public void onTick(long millisUnitFinished) {
timerMilliseconds = millisUnitFinished;
textView.setText("seconds remaining: " + ((millisUnitFinished / 1000) + 1));
}
};
}
@Override
public void onResume() {
// Start or resume the game.
super.onResume();
if (gameIsInProgress) {
resumeGame(timerMilliseconds);
}
}
@Override
public void onPause() {
// Cancel the timer if the game is paused.
countDownTimer.cancel();
super.onPause();
}
private void showInterstitial() {
// Show the ad if it's ready. Otherwise toast and restart the game.
if (interstitialAd != null && interstitialAd.isLoaded()) {
interstitialAd.show();
} else {
Toast.makeText(this, "Ad did not load", Toast.LENGTH_SHORT).show();
startGame();
}
}
private void startGame() {
// Request a new ad if one isn't already loaded, hide the button, and kick off the timer.
if (!interstitialAd.isLoading() && !interstitialAd.isLoaded()) {
AdRequest adRequest = new AdRequest.Builder().build();
interstitialAd.loadAd(adRequest);
}
retryButton.setVisibility(View.INVISIBLE);
resumeGame(GAME_LENGTH_MILLISECONDS);
}
private void resumeGame(long milliseconds) {
// Create a new timer for the correct length and start it.
gameIsInProgress = true;
timerMilliseconds = milliseconds;
createTimer(milliseconds);
countDownTimer.start();
}
}
2. Androidmanifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="admobtest.com.theaterwin.theateradmobtest">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-4942856506050335~1501960845"/>
</application>
</manifest>
3. vales - strings.xml
<resources>
<string name="app_name">TheaterAdmobTest</string>
<string name="action_settings">Settings</string>
<string name="impossible_game">Impossible Game</string>
<string name="ad_unit_id">ca-app-pub-4942856506050335/8049265316</string>
</resources>