2016년 3월 4일 금요일

로고 화면 및 광고

Handler handler = new Handler() {
public void handleMessage(Message msg) {
//Intent intent = new Intent(Logo.this, LetterActivity.class);
Intent intent = new Intent(Logo.this, SetupMyInfo.class);
startActivity(intent);
finish();
}
};

handler.sendEmptyMessageDelayed(0, 1400);



private AdView adView;
private InterstitialAd interstitial;

AdRequest adRequest;
LinearLayout adLayout;
private void showAd() {
adView = new AdView(this);
adView.setAdSize(AdSize.SMART_BANNER);
adView.setAdUnitId(MyUtil.AD_UNIT_ID);

adLayout = (LinearLayout) findViewById(R.id.adSpace);
adLayout.addView(adView);

interstitial = new InterstitialAd(this);
interstitial.setAdUnitId(MyUtil.AD_INTERSTITIAL_ID);

interstitial.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
}

@Override
public void onAdFailedToLoad(int errorCode) {
}

@Override
public void onAdClosed() {
interstitial.loadAd(adRequest);
}
});


if (MyUtil.TESTING) {
adRequest = new AdRequest.Builder()
.addTestDevice(MyUtil.testDeviceId)
.build();
}
else {
adRequest = new AdRequest.Builder().build();
}
interstitial.loadAd(adRequest);
adView.loadAd(adRequest);
}

public void displayInterstitial() {
if (interstitial == null) return;
if (interstitial.isLoaded()) {
interstitial.show();
}
}