Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
- scheduler.scheduleAtFixedRate(new Runnable() {
- public void run() {
- runOnUiThread(new Runnable() {
- public void run() {
- interstitialAd = new InterstitialAd(MainActivity.this);
- interstitialAd.setAdUnitId(getString(R.string.admob_interstitial_id));
- AdRequest adRequest = new AdRequest.Builder().build();
- interstitialAd.loadAd(adRequest);
- interstitialAd.setAdListener(new AdListener() {
- public void onAdLoaded() {
- if (interstitialAd.isLoaded()) {
- interstitialAd.show();
- }
- }
- });
- }
- });
- }
- }, 120, 120, TimeUnit.SECONDS);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement