當前位置: 首頁>>代碼示例>>Java>>正文


Java InterstitialAd類代碼示例

本文整理匯總了Java中com.google.android.gms.ads.InterstitialAd的典型用法代碼示例。如果您正苦於以下問題:Java InterstitialAd類的具體用法?Java InterstitialAd怎麽用?Java InterstitialAd使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


InterstitialAd類屬於com.google.android.gms.ads包,在下文中一共展示了InterstitialAd類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onGotIt

import com.google.android.gms.ads.InterstitialAd; //導入依賴的package包/類
public void onGotIt(View button) {
    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
    SharedPreferences.Editor prefEditor = settings.edit();
    prefEditor.putBoolean("gotIt", true);
    prefEditor.apply();

    Intent i = new Intent(this, SettingsActivity.class);
    startActivity(i);

    //mInterstitialAd.show();
    InterstitialAd ad1 = AdManager.getAd1();
    if (ad1.isLoaded()) {
        ad1.show();
    }
    //interventie 2
    Log.d("ADS_REACH","Reached ad code");

    finish();


    //aici era interstitial initial

}
 
開發者ID:RomascuAndrei,項目名稱:BTNotifierAndroid,代碼行數:24,代碼來源:WelcomeActivity.java

示例2: showFullScreenAdsIfRequired

import com.google.android.gms.ads.InterstitialAd; //導入依賴的package包/類
public static void showFullScreenAdsIfRequired(final StateActivity activity) {
    if (Premium.isPremiumUser(activity)) return;
    final InterstitialAd interstitialAd = new InterstitialAd(activity.getApplicationContext());
    interstitialAd.setAdUnitId(AdConstants.AdUnitId.AD_UNIT_ID_INTERSTITIAL);
    AdRequest.Builder request = new AdRequest.Builder();
    if (BuildConfig.DEBUG) {
        request.addTestDevice(TEST_DEVICE_ID);
    }
    interstitialAd.loadAd(request.build());
    interstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdLoaded() {
            super.onAdLoaded();
            if (!activity.isFinishing() && activity.isActivityVisible()) {
                interstitialAd.show();
            }
        }
    });
}
 
開發者ID:tranleduy2000,項目名稱:text_converter,代碼行數:20,代碼來源:AdsManager.java

示例3: onCreateView

import com.google.android.gms.ads.InterstitialAd; //導入依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_cafeterias, container, false);
    ButterKnife.bind(this, view);

    mInterstitialAd = new InterstitialAd(getContext());
    mInterstitialAd.setAdUnitId("ca-app-pub-3940256099942544/1033173712");
    AdRequest adRequest = new AdRequest.Builder().build();
    mInterstitialAd.loadAd(adRequest);

    CustomListAdaptor customListAdaptor = new CustomListAdaptor(getContext(), Arrays.asList(getResources().getStringArray(R.array.cafeterias)));
    lvCafeterias.setAdapter(customListAdaptor);

    lvCafeterias.animate().setDuration(500);

    return view;
}
 
開發者ID:yusufcakal,項目名稱:CuYemek,代碼行數:19,代碼來源:CafeteriasFragment.java

示例4: createNewIntAd

import com.google.android.gms.ads.InterstitialAd; //導入依賴的package包/類
private InterstitialAd createNewIntAd() {
    InterstitialAd intAd = new InterstitialAd(context);
    intAd.setAdUnitId(context.getString(R.string.tip_click_int_ad_id));
    intAd.setAdListener(new AdListener() {
        @Override
        public void onAdLoaded() {

        }

        @Override
        public void onAdFailedToLoad(int errorCode) {

        }

        @Override
        public void onAdClosed() {
            // Proceed to the next level.
            //levelTwo();
        }
    });
    return intAd;
}
 
開發者ID:shivam301296,項目名稱:True-Weather,代碼行數:23,代碼來源:AdBhai.java

示例5: onCreate

import com.google.android.gms.ads.InterstitialAd; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_second);
    mInterstitialAd = new InterstitialAd(this);

    // set the ad unit ID
    mInterstitialAd.setAdUnitId(getString(R.string.interstitial_full_screen));

    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice("DCAB007CDB3101E631F092966F546CC2")
            .build();

    // Load ads into Interstitial Ads
    mInterstitialAd.loadAd(adRequest);

    mInterstitialAd.setAdListener(new AdListener() {
        public void onAdLoaded() {
            showInterstitial();
        }
    });
}
 
開發者ID:anwarcse12028,項目名稱:Ad-Mob,代碼行數:23,代碼來源:SecondActivity.java

示例6: setUpAds

import com.google.android.gms.ads.InterstitialAd; //導入依賴的package包/類
private void setUpAds() {
    AdRequest adRequest = new AdRequest.Builder().build();
    adView.loadAd(adRequest);
    interstitialAd = new InterstitialAd(getContext());
    interstitialAd.setAdUnitId(interstitialAdUnitId);
    interstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdFailedToLoad(int i) {
            super.onAdFailedToLoad(i);
            requestNewInterstitial();
        }

        @Override
        public void onAdClosed() {
            super.onAdClosed();
            requestNewInterstitial();
        }

        @Override
        public void onAdOpened() {
            super.onAdOpened();
            requestNewInterstitial();
        }
    });
    requestNewInterstitial();
}
 
開發者ID:Protino,項目名稱:Build-it-Bigger,代碼行數:27,代碼來源:MainFragment.java

示例7: request

import com.google.android.gms.ads.InterstitialAd; //導入依賴的package包/類
@Override
protected void request(Context context, Map<String, String> networkData) {
    if (context == null || networkData == null) {
        invokeLoadFail(PNException.ADAPTER_ILLEGAL_ARGUMENTS);
    } else {
        String unitId = networkData.get(AdMob.KEY_UNIT_ID);
        if (TextUtils.isEmpty(unitId)) {
            invokeLoadFail(PNException.ADAPTER_MISSING_DATA);
        } else {
            mInterstitialAd = new InterstitialAd(mContext);
            mInterstitialAd.setAdUnitId(unitId);
            mInterstitialAd.setAdListener(mAdListener);
            mInterstitialAd.loadAd(AdMob.getAdRequest(context));
        }
    }
}
 
開發者ID:pubnative,項目名稱:pubnative-android-sdk,代碼行數:17,代碼來源:AdMobInterstitialAdAdapter.java

示例8: initADs

import com.google.android.gms.ads.InterstitialAd; //導入依賴的package包/類
void initADs() {

		if(enableADs) {
			//https://firebase.google.com/docs/admob/android/quick-start
			MobileAds.initialize(getApplicationContext(), getString(R.string.ad_app_id));
			AdView mAdView = (AdView) findViewById(R.id.adView);
			AdRequest adRequest = new AdRequest.Builder().build();
			mAdView.loadAd(adRequest);
			Log.d(LOG_TAG, "Ads initialized..");

			mInterstitialAd = new InterstitialAd(this);
			mInterstitialAd.setAdUnitId(getString(R.string.interstitial_ad_unit_id));
			mInterstitialAd.setAdListener(new AdListener() {
				@Override
				public void onAdClosed() {
					//requestNewInterstitial();
				}
			});

			requestNewInterstitial();
		}
	}
 
開發者ID:GokulNC,項目名稱:USB_Mass_Storage_Enabler,代碼行數:23,代碼來源:MainActivity.java

示例9: onCreate

import com.google.android.gms.ads.InterstitialAd; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mInterstitialAd = new InterstitialAd(getActivity());
    mInterstitialAd.setAdUnitId("ca-app-pub-3940256099942544/1033173712");

    mInterstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdClosed() {
            requestNewInterstitial();
            openJokeActivity();
        }
    });

    requestNewInterstitial();
}
 
開發者ID:frank-tan,項目名稱:BuildItBigger,代碼行數:18,代碼來源:MainActivityFragment.java

示例10: showIntersitialAdOnNextLevel

import com.google.android.gms.ads.InterstitialAd; //導入依賴的package包/類
boolean showIntersitialAdOnNextLevel(InterstitialAd intersitialAdOnNextLevel, int actualLevel) {
    if (actualLevel % 2 == 0) {
        if (intersitialAdOnNextLevel.isLoaded()) {
            intersitialAdOnNextLevel.show();
            return true;
        } else {
            return false;
        }
    }else{
        return false;
    }


}
 
開發者ID:hypeapps,項目名稱:FixMath,代碼行數:15,代碼來源:PlayActivity.java

示例11: onCreateView

import com.google.android.gms.ads.InterstitialAd; //導入依賴的package包/類
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    final View rootView = inflater.inflate(R.layout.fragment_main, container, false);

    this.mButtonStartInterstitial = (AppCompatButton) rootView.findViewById(R.id.buttonStartInterstitial);
    this.mButtonStartInterstitial.setOnClickListener(this.mOnClickListener);

    this.mAdView = (AdView) rootView.findViewById(R.id.adView);
    this.mAdView.setAdListener(this.mAdListener);
    this.mAdView.loadAd(new AdRequest.Builder().build());

    this.mInterstitialAd = new InterstitialAd(this.getActivity());
    this.mInterstitialAd.setAdUnitId(this.getString(R.string.app_ad));
    this.mInterstitialAd.setAdListener(this.mAdListener);
    this.mInterstitialAd.loadAd(new AdRequest.Builder().build());

    return rootView;
}
 
開發者ID:jaredsburrows,項目名稱:android-gradle-java-app-template,代碼行數:21,代碼來源:PlaceholderFragment.java

示例12: setUpInterstitialAd

import com.google.android.gms.ads.InterstitialAd; //導入依賴的package包/類
/**
 * Sets up the interstitial ad object.
 */
private void setUpInterstitialAd() throws Exception {
    if (!(advertable instanceof  Activity)) {
        throw new Exception("Only Activity class can implement HackChatInterstitialAdvertable.");
    }
    interstitialAd = new InterstitialAd((Activity) advertable);
    interstitialAd.setAdUnitId(adUnitId);

    interstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdClosed() {
            advertable.onInterstitialAdClosed();
        }
    });

    requestInterstitialAd();
}
 
開發者ID:RudraNirvan,項目名稱:hack.chat-android,代碼行數:20,代碼來源:HackChatInterstitialAd.java

示例13: initAdmob

import com.google.android.gms.ads.InterstitialAd; //導入依賴的package包/類
/**
 * Ads for the app.
 */
private void initAdmob() {
	int curTime = App.Instance.getAdsShownTimes();
	int adsTimes = 7;
	if (curTime % adsTimes == 0) {
		// Create an ad.
		mInterstitialAd = new InterstitialAd(this);
		mInterstitialAd.setAdUnitId(getString(R.string.interstitial_ad_unit_id));
		// Create ad request.
		AdRequest adRequest = new AdRequest.Builder().build();
		// Begin loading your interstitial.
		mInterstitialAd.setAdListener(new AdListener() {
			@Override
			public void onAdLoaded() {
				super.onAdLoaded();
				displayInterstitial();
			}
		});
		mInterstitialAd.loadAd(adRequest);
	}
	curTime++;
	App.Instance.setAdsShownTimes(curTime);
}
 
開發者ID:XinyueZ,項目名稱:marsTemp,代碼行數:26,代碼來源:MainActivity.java

示例14: onCreate

import com.google.android.gms.ads.InterstitialAd; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_fragment_location);
    mInterstitialAd = new InterstitialAd(this);
    mInterstitialAd.setAdUnitId(getResources().getString(R.string.interstitial_ad));
    mInterstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdClosed() {
            finish();
        }
    });
    AdRequest adRequest = new AdRequest.Builder().build();
    mInterstitialAd.loadAd(adRequest);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
}
 
開發者ID:akashandroid90,項目名稱:GooglePlayServiceLocationSupport,代碼行數:19,代碼來源:FragmentLocationActivity.java

示例15: handleInterstitialAd

import com.google.android.gms.ads.InterstitialAd; //導入依賴的package包/類
private void handleInterstitialAd() {
	String adId = Preferences.getInstance(this).getAdmobInterstitialId();
	if (adId == null || adId.length() == 0)
		return;

	interstitial = new InterstitialAd(this);
	interstitial.setAdUnitId(adId);
	// Create ad request.
	AdRequest adRequest = new AdRequest.Builder().build();
	// Begin loading your interstitial.
	interstitial.loadAd(adRequest);

	interstitial.setAdListener(new AdListener() {
		public void onAdLoaded() {
			if (interstitial.isLoaded()) {
				interstitial.show();
			}
		}
	});
	
}
 
開發者ID:Barqawiz,項目名稱:Android_ApplicationTemplate,代碼行數:22,代碼來源:MainActivity.java


注:本文中的com.google.android.gms.ads.InterstitialAd類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。