@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_main, container, false); AdView mAdView = (AdView) root.findViewById(R.id.adView); // Create an ad request. Check logcat output for the hashed device ID to // get test ads on a physical device. e.g. // "Use AdRequest.Builder.addTestDevice("ABCDEF012345") to get test ads on this device." AdRequest adRequest = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) .build(); mAdView.loadAd(adRequest); return root; }
public void GoogleMobileAds_LoadInterstitial() { RunnerActivity.ViewHandler.post( new Runnable() { public void run() { if(interstitialAd==null) initInterstitial(); AdRequest.Builder builder = new AdRequest.Builder(); builder.addTestDevice(AdRequest.DEVICE_ID_EMULATOR); if( bUseTestAds) builder.addTestDevice(TestDeviceId); AdRequest adRequest = builder.build(); // Load the interstitial ad. interstitialAd.loadAd(adRequest); }}); }
@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(); } }); }
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { mView = inflater.inflate(R.layout.more_info_fragment, container, false); ButterKnife.bind(this, mView); auth.getCurrentUser(); Uri photoUrl = auth.getCurrentUser().getPhotoUrl(); Glide.with(this).load(photoUrl).into(imageView); String strMeatFormat = getResources().getString(R.string.welcome_format); String strMeatMsg = String.format(strMeatFormat, auth.getCurrentUser().getDisplayName()); mProfileName.setText(strMeatMsg); adView = (AdView) mView.findViewById(R.id.adView); AdRequest builder = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build(); adView.loadAd(builder); return mView; }
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(); } } }); }
@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; }
private void enableAds() { RelativeLayout rlAd = (RelativeLayout) findViewById(R.id.rlAd); LinearLayout llAd = (LinearLayout) findViewById(R.id.llAd); final AdView adView = (AdView) findViewById(R.id.adView); rlAd.setVisibility(View.VISIBLE); llAd.setVisibility(View.VISIBLE); Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { try { AdRequest adRequest = new AdRequest.Builder() .addTestDevice(getString(R.string.ad_test_device_id)) .build(); adView.loadAd(adRequest); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } } }, 1000); }
private void showAds() { // mInterstitialAd = new InterstitialAd(getActivity()); // request the ad if (!mInterstitialAd.isLoaded()) { Log.d(TAG, "isLoaded: " + String.valueOf(mInterstitialAd.isLoaded())); AdRequest ar = new AdRequest.Builder().build(); mInterstitialAd.loadAd(ar); } // show the ad Log.d(TAG, "showAds: isItTimeToShowAds" + String.valueOf(isItTimeToShowAds)); if (isItTimeToShowAds % 3 == 0) { if (mInterstitialAd.isLoaded()) { mInterstitialAd.show(); } } ++isItTimeToShowAds; Log.d(TAG, "showAds: isItTimeToShowAds" + String.valueOf(isItTimeToShowAds)); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidThreeTen.init(this); start_date = LocalDate.now(); end_date = LocalDate.now(); seed = DEFAULT_SEED; setContentView(R.layout.activity_main); // Load an ad into the AdMob banner view. AdView adView = (AdView) findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().setRequestAgent("android_studio:ad_template").build(); adView.loadAd(adRequest); potd_list_view = (ListView) findViewById(R.id.potd_list); generate_potd_list(); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_quiz15, container, false); String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID); String deviceId = md5(android_id).toUpperCase(); Log.i("device id=",deviceId); AdView adView = (AdView)view.findViewById(R.id.adViewques15); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(deviceId) .build(); adView.loadAd(adRequest); return view; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_quiz5, container, false); String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID); String deviceId = md5(android_id).toUpperCase(); Log.i("device id=",deviceId); AdView adView = (AdView)view.findViewById(R.id.adViewques5); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(deviceId) .build(); adView.loadAd(adRequest); return view; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_quiz9, container, false); String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID); String deviceId = md5(android_id).toUpperCase(); Log.i("device id=",deviceId); AdView adView = (AdView)view.findViewById(R.id.adViewques9); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(deviceId) .build(); adView.loadAd(adRequest); return view; }
@Override public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.fragment_quiz3, container, false); String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID); String deviceId = md5(android_id).toUpperCase(); Log.i("device id=",deviceId); AdView adView = (AdView)v.findViewById(R.id.adViewques3); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(deviceId) .build(); adView.loadAd(adRequest); return v; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_quiz10, container, false); String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID); String deviceId = md5(android_id).toUpperCase(); Log.i("device id=",deviceId); AdView adView = (AdView)view.findViewById(R.id.adViewques10); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(deviceId) .build(); adView.loadAd(adRequest); return view; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.fragment_quiz2, container, false); String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID); String deviceId = md5(android_id).toUpperCase(); Log.i("device id=",deviceId); AdView adView = (AdView)v.findViewById(R.id.adViewques2); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(deviceId) .build(); adView.loadAd(adRequest); return v; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_quiz4, container, false); String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID); String deviceId = md5(android_id).toUpperCase(); Log.i("device id=",deviceId); AdView adView = (AdView)view.findViewById(R.id.adViewques4); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(deviceId) .build(); adView.loadAd(adRequest); return view; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_quiz14, container, false); String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID); String deviceId = md5(android_id).toUpperCase(); Log.i("device id=",deviceId); AdView adView = (AdView)view.findViewById(R.id.adViewques14); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(deviceId) .build(); adView.loadAd(adRequest); return view; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_quiz7, container, false); String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID); String deviceId = md5(android_id).toUpperCase(); Log.i("device id=",deviceId); AdView adView = (AdView)view.findViewById(R.id.adViewques7); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(deviceId) .build(); adView.loadAd(adRequest); return view; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_quiz6, container, false); String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID); String deviceId = md5(android_id).toUpperCase(); Log.i("device id=",deviceId); AdView adView = (AdView)view.findViewById(R.id.adViewques6); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(deviceId) .build(); adView.loadAd(adRequest); return view; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.fragment_quiz8, container, false); String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID); String deviceId = md5(android_id).toUpperCase(); Log.i("device id=",deviceId); AdView adView = (AdView)v.findViewById(R.id.adViewques8); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(deviceId) .build(); adView.loadAd(adRequest); return v; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_quiz11, container, false); String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID); String deviceId = md5(android_id).toUpperCase(); Log.i("device id=",deviceId); AdView adView = (AdView)view.findViewById(R.id.adViewques11); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(deviceId) .build(); adView.loadAd(adRequest); return view; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.fragment_quiz1, container, false); String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID); String deviceId = md5(android_id).toUpperCase(); Log.i("device id=",deviceId); AdView adView = (AdView)v.findViewById(R.id.adViewques1); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(deviceId) .build(); adView.loadAd(adRequest); return v; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment //ca-app-pub-2683690631160044/9215612617 View view = inflater.inflate(R.layout.fragment_future, container, false); TextView textView = (TextView)view.findViewById(R.id.pythonfuture); String str = getResources().getString(R.string.applications); //noinspection deprecation textView.setText(Html.fromHtml(str)); String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID); String deviceId = md5(android_id).toUpperCase(); Log.i("device id=",deviceId); AdView adView = (AdView)view.findViewById(R.id.adViewFuture); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(deviceId) .build(); adView.loadAd(adRequest); return view; }
private void requestNewRewardedVideo() { if (_config == null) { return; } AdRequest.Builder adRB = new AdRequest.Builder(); if (BuildConfig.DEBUG) { adRB.addTestDevice(AdRequest.DEVICE_ID_EMULATOR); adRB.addTestDevice(Utils.getDeviceId(activity)); } String ad_unit_id = _config.optString("RewardedVideoAdId", ""); if (ad_unit_id.length() <= 0) { Utils.d("AdMob:RewardedVideo:UnitId:NotProvided"); ad_unit_id = activity.getString(R.string.rewarded_video_ad_unit_id); } mrv.loadAd(ad_unit_id, adRB.build()); }
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(); }
private void initAds() { MobileAds.initialize(this, "ca-app-pub-2757743767659351~9555852028"); //MobileAds.initialize(this, "ca-app-pub-3940256099942544~3347511713"); // Test bigAd = new InterstitialAd(this); bigAd.setAdUnitId("ca-app-pub-2757743767659351/2179020563"); bigAd.loadAd(new AdRequest.Builder().build()); adTop = findViewById(R.id.adViewTop); adBottom = findViewById(R.id.adViewBottom); adBottom.loadAd(new AdRequest.Builder().build()); adTop.loadAd(new AdRequest.Builder().build()); }
private void loadRewardedVideoAd() { Bundle extras = new Bundle(); extras.putBoolean("is_designed_for_families", true); mRewardedVideoAd.loadAd(getResources().getString(R.string.ad_unit_id_rewarded_donation), new AdRequest.Builder() .addTestDevice(getString(R.string.test_device_oneplus_3)) .addTestDevice(getString(R.string.test_device_honor_6)) .addTestDevice(getString(R.string.test_device_htc_one_m8)) .addNetworkExtrasBundle(AdMobAdapter.class, extras) .tagForChildDirectedTreatment(true) .build()); }
public static void initializeAds(Context context, NativeExpressAdView adView) { MobileAds.initialize(context, "ca-app-pub-8963908741443055~4285788324"); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) // All emulators .addTestDevice("EF67DDDDDDD0896B1B02876D927AC309") // An example device ID .build(); Log.d("initializeAds: ", adView.getAdUnitId()); adView.loadAd(adRequest); }
public static void initializeAds(Context context, AdView adView) { MobileAds.initialize(context, "ca-app-pub-8963908741443055~4285788324"); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) // All emulators .addTestDevice("EF67DDDDDDD0896B1B02876D927AC309") // An example device ID .build(); Log.d("initializeAds: ", adView.getAdUnitId()); adView.loadAd(adRequest); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_result); sp = PreferenceManager.getDefaultSharedPreferences(this); adView = (AdView) findViewById(R.id.avViewr); tv1 = (TextView) findViewById(R.id.tv1); tv2 = (TextView) findViewById(R.id.tv2); tv3 = (TextView) findViewById(R.id.tv3); Toolbar toolbar = (Toolbar) findViewById(R.id.app_bar); toolbar.setTitle("Result"); setSupportActionBar(toolbar); displayAnswer1(); displayAnswer2(); displayAnswer3(); initAds(); mInterAd = new InterstitialAd(this); mInterAd.setAdUnitId(getResources().getString(R.string.finish_inter_ad_id)); mInterAd.loadAd(new AdRequest.Builder().build()); mInterAd.setAdListener(new AdListener() { @Override public void onAdClosed() { super.onAdClosed(); finish(); } }); }
private void initAds() { AdRequest adRequest = new AdRequest.Builder() .build(); // Start loading the ad in the background. adView.loadAd(adRequest); }
public static void loadAd(final View view){ final Builder builder = new AdRequest.Builder(); builder.addTestDevice(AdRequest.DEVICE_ID_EMULATOR); // Emulator // Add test devices final String[] testDevices = view.getContext().getString(R.string.testDevices).split(","); for (String testDevice:testDevices){ builder.addTestDevice(testDevice); } final AdView adView = (AdView) view.findViewById(R.id.adView); adView.loadAd(builder.build()); }
private void requestNewRewardedVideo(RewardedVideoAd mrv, String unitid) { Utils.d("AdMob:Loading:RewardedAd:For: "+unitid); AdRequest.Builder adRB = new AdRequest.Builder(); if (BuildConfig.DEBUG) { adRB.addTestDevice(AdRequest.DEVICE_ID_EMULATOR); adRB.addTestDevice(Utils.getDeviceId(activity)); } mrv.loadAd(unitid, adRB.build()); }
private void requestNewInterstitial() { AdRequest.Builder adRB = new AdRequest.Builder(); if (BuildConfig.DEBUG) { adRB.addTestDevice(AdRequest.DEVICE_ID_EMULATOR); adRB.addTestDevice(Utils.getDeviceId(activity)); } AdRequest adRequest = adRB.build(); mInterstitialAd.loadAd(adRequest); }
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.fragment_dashboard, container, false); ButterKnife.bind(this, rootView); Icepick.restoreInstanceState(this, savedInstanceState); context = getActivity(); setContext(context); setChartColors(chartColors); if (savedInstanceState == null) { firebaseUid = CacheUtils.getFirebaseUserId(context); } FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance(); statsDatabaseRef = firebaseDatabase.getReference().child("users").child(firebaseUid).child("stats"); projectsDatabaseRef = firebaseDatabase.getReference().child("users").child(firebaseUid).child("timeSpentOnProjects"); setUpActivityChart(); setListeners(); swipeRefreshLayout.setRefreshing(true); AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); if (scrollPosition != null && scrollView != null) { scrollView.post(new Runnable() { @Override public void run() { scrollView.scrollTo(0, scrollPosition); } }); } return rootView; }
private void initAd() { ratingUs.setVisibility(View.GONE); AdRequest request = new AdRequest.Builder() .addTestDevice("43FE98603DD8DD9E449808D85C7DBD45") .build(); adView.loadAd(request); adView.setVisibility(View.VISIBLE); }
private void requestNewInterstitial() { AdRequest adRequest = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) .addTestDevice("19958886412D28A5FFC7BA20F66C6FF5") .build(); mInterstitialAd.loadAd(adRequest); }
private void createAdInterstitial() { if (!BuildConfig.IS_PREMIUM_USER || hasPremiumApp()) { //create ad interstitialAd = new InterstitialAd(this); if (BuildConfig.DEBUG) { interstitialAd.setAdUnitId("ca-app-pub-3940256099942544/1033173712"); } else { interstitialAd.setAdUnitId(getString(R.string.interstitial_full_screen)); } interstitialAd.loadAd(new AdRequest.Builder().build()); } }