private void showInterstitial() { if (interstitial == null) { interstitial = new InterstitialAd(this); interstitial.setAdUnitId(getResources().getString(R.string.interstitial_unit_id)); interstitial.setAdListener( new AdListener() { @Override public void onAdLoaded() { if (interstitial.isLoaded()) { interstitial.show(); timeForRun = Calendar.getInstance().getTime().getTime(); numberOfSelectItem = 1; } } @Override public void onAdClosed() {} @Override public void onAdFailedToLoad(int errorCode) {} }); } AdRequest adRequest_interstitial = new AdRequest.Builder().build(); interstitial.loadAd(adRequest_interstitial); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_collage_editor); getSupportActionBar().setDisplayHomeAsUpEnabled(true); interstitial = new InterstitialAd(this); interstitial.setAdUnitId(getString(R.string.interstitial_ad_unit_id)); // Create ad request. AdRequest adRequest = new AdRequest.Builder().build(); // Begin loading your interstitial. interstitial.loadAd(adRequest); Intent i = getIntent(); imgid = i.getIntExtra("frameId", 0); typeId = i.getIntExtra("typeId", 0); imgBackground = (ImageView) findViewById(R.id.imgBackground); imgBackground.setBackgroundResource(imgid); ViewTreeObserver vto = imgBackground.getViewTreeObserver(); // vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { // @SuppressLint("NewApi") // @SuppressWarnings("deprecation") // @Override // public void onGlobalLayout() { // imgBackgroundWidth = imgBackground.getWidth(); // imgBackgroundHeight = imgBackground.getHeight(); // GenerateUI(); // // if (android.os.Build.VERSION.SDK_INT >= // android.os.Build.VERSION_CODES.JELLY_BEAN) // imgBackground.getViewTreeObserver().removeOnGlobalLayoutListener(this); // else // imgBackground.getViewTreeObserver().removeGlobalOnLayoutListener(this); // // // } // }); vto.addOnPreDrawListener( new ViewTreeObserver.OnPreDrawListener() { public boolean onPreDraw() { imgBackgroundWidth = imgBackground.getWidth(); imgBackgroundHeight = imgBackground.getHeight(); GenerateUI(); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) imgBackground.getViewTreeObserver().removeOnPreDrawListener(this); else imgBackground.getViewTreeObserver().removeOnPreDrawListener(this); return true; } }); collageEditorRelativeLayout = (RelativeLayout) findViewById(R.id.collageEditorRelativeLayout); }
@Override public void onClick(View v) { mLoadInterstitialAdButton.setEnabled(false); mLoadInterstitialAdButton.setText( getResources().getText(R.string.start_load_interstitial_button)); mInterstitialAd.loadAd(mAdRequest); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); linearLayout = (LinearLayout) findViewById(R.id.linearLayout); adView_1 = new AdView(this); adView_1.setAdUnitId("ca-app-pub-2538596252160048/1329783818"); adView_1.setAdSize(AdSize.BANNER); linearLayout.addView(adView_1); adView_2 = new AdView(this); adView_2.setAdUnitId("ca-app-pub-2538596252160048/1329783818"); adView_2.setAdSize(AdSize.MEDIUM_RECTANGLE); linearLayout.addView(adView_2); interstitial = new InterstitialAd(this); interstitial.setAdUnitId("ca-app-pub-2538596252160048/1329783818"); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) .addTestDevice("AF8CDE91144F6A31C28629FD2573AB82") .build(); adView_1.setAdListener( new AdListener() { @Override public void onAdLoaded() { Log.i("Script", "onAdLoaded()"); } @Override public void onAdFailedToLoad(int error) { Log.i("Script", "onAdFailedToLoad(" + error + ")"); } @Override public void onAdOpened() { Log.i("Script", "onAdOpened()"); } @Override public void onAdClosed() { Log.i("Script", "onAdClosed()"); } @Override public void onAdLeftApplication() { Log.i("Script", "onAdLeftApplication()"); } }); adView_1.loadAd(adRequest); adView_2.loadAd(adRequest); interstitial.loadAd(adRequest); }
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.learndigits); try { toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); SharedPreferences pref = getSharedPreferences("ASL", Context.MODE_PRIVATE); CommonThings.PAID_APP = pref.getString("PAID", "temp"); if (CommonThings.PAID_APP.equalsIgnoreCase("temp")) { AdView adView = (AdView) this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().addTestDevice("A38A51D43110AAD81A8E3AE3AC468C32").build(); adView.loadAd(adRequest); // Interstitials ad interstitialAd = new InterstitialAd(this); interstitialAd.setAdUnitId(getResources().getString(R.string.interstitialid)); interstitialAd.loadAd(adRequest); interstitialAd.setAdListener( new AdListener() { @Override public void onAdLoaded() { // TODO Auto-generated method stub DisplayAd(); } }); } // btn_nex = (ImageButton) findViewById(R.id.btnForward); btn_back = (ImageButton) findViewById(R.id.btnBackward); btn_last = (ImageButton) findViewById(R.id.btnNext); btn_first = (ImageButton) findViewById(R.id.btnPrevious); imageView1 = (ImageView) findViewById(R.id.imageView1); tv_hotvines = (TextView) findViewById(R.id.tv_hotvines); animationFadeIn = AnimationUtils.loadAnimation(this, R.anim.right_out); mp = MediaPlayer.create(this, sounds[curr]); mp.start(); btn_nex.setOnClickListener(this); btn_back.setOnClickListener(this); btn_first.setOnClickListener(this); btn_last.setOnClickListener(this); tv_hotvines.setOnClickListener(this); } catch (Exception ex) { DebugLog.console(ex, "Learn_Digits onCreate Exception"); } }
/** * Initialize the interstitial ads * * @param c */ public void initAds(Context c) { interstitialAd = new InterstitialAd(c); interstitialAd.setAdUnitId("a15391920065568"); interstitialAd.setAdListener(adListener); AdRequest.Builder adRequestBuilder = new AdRequest.Builder(); adRequestBuilder.addTestDevice(AdRequest.DEVICE_ID_EMULATOR); // adRequestBuilder.addTestDevice("D9B017A3983BD8CB8B38C927F7C5E330"); adRequest = adRequestBuilder.build(); interstitialAd.loadAd(adRequest); }
/** Called when the Load Interstitial button is clicked. */ public void loadInterstitial(View unusedView) { // Disable the show button until the new ad is loaded. // Check the logcat output for your hashed device ID to get test ads on // a physical device. AdRequest adRequest = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) .addTestDevice("AC98C820A50B4AD8A2106EDE96FB87D4") .build(); // Load the interstitial ad. interstitialAd.loadAd(adRequest); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_main, container, false); mInterstitialAd = new InterstitialAd(getContext()); mInterstitialAd.setAdUnitId(getString(R.string.interstitial_ad_unit_id)); mInterstitialAd.setAdListener( new AdListener() { @Override public void onAdClosed() { super.onAdClosed(); mInterstitialAd.loadAd(getTestAdRequest()); launchJokeActivity(mJoke); } }); mInterstitialAd.loadAd(getTestAdRequest()); AdView mAdView = (AdView) root.findViewById(R.id.adView); mAdView.loadAd(getTestAdRequest()); final ProgressBar progressBar = (ProgressBar) root.findViewById(R.id.progress_bar); Button tellJokeButton = (Button) root.findViewById(R.id.tell_joke_button); tellJokeButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { progressBar.setVisibility(View.VISIBLE); new FetchJokeAsyncTask() .execute( new FetchJokeAsyncTask.FetchJokeTaskCallback() { @Override public void handleJoke(String joke) { mJoke = joke; progressBar.setVisibility(View.GONE); if (mInterstitialAd.isLoaded()) { mInterstitialAd.show(); } else { launchJokeActivity(joke); } } }); } }); return root; }
private void loadAdware() { // Adware Main Activity AdView mAdView = (AdView) findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().build(); /*AdRequest adRequest = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) .addTestDevice("E112885C2D32D31690C7B60F25C89356") .addTestDevice("13E7A5DDF2981F979D554ED02BC571B3") .build();*/ mAdView.loadAd(adRequest); // Adware interstitial ads mInterstitialAd = new InterstitialAd(this); mInterstitialAd.setAdUnitId(this.getString(R.string.banner_ad_unit_id)); /*AdRequest adRequestInterstitialAd = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) .addTestDevice("E112885C2D32D31690C7B60F25C89356") .addTestDevice("13E7A5DDF2981F979D554ED02BC571B3") .build();*/ AdRequest adRequestInterstitialAd = new AdRequest.Builder().build(); mInterstitialAd.loadAd(adRequestInterstitialAd); }
@Override protected void onPostExecute(String result) { super.onPostExecute(result); mResult = result; // Setting the interstitial ad interstitialAd = new InterstitialAd(context); interstitialAd.setAdUnitId(context.getString(R.string.interstitial_ad_unit_id)); interstitialAd.setAdListener( new AdListener() { @Override public void onAdLoaded() { super.onAdLoaded(); if (progressBar != null) { progressBar.setVisibility(View.GONE); } interstitialAd.show(); } @Override public void onAdFailedToLoad(int errorCode) { super.onAdFailedToLoad(errorCode); if (progressBar != null) { progressBar.setVisibility(View.GONE); } startJokeActivity(); } @Override public void onAdClosed() { startJokeActivity(); } }); AdRequest ar = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build(); interstitialAd.loadAd(ar); }
// https://developers.google.com/admob/android/interstitial?hl=en private void requestNewInterstitial() { AdRequest adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build(); mInterstitialAd.loadAd(adRequest); }
@Override public void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.fullimageslider); db = new DatabaseHandler(this); dbManager = DatabaseManager.INSTANCE; dbManager.init(getApplicationContext()); getSupportActionBar().setDisplayHomeAsUpEnabled(true); options = new DisplayImageOptions.Builder() .showImageForEmptyUri(R.drawable.ic_launcher) .showImageOnFail(R.drawable.ic_launcher) .resetViewBeforeLoading(true) .cacheOnDisc(true) .imageScaleType(ImageScaleType.EXACTLY) .bitmapConfig(Bitmap.Config.RGB_565) .considerExifParams(true) .displayer(new FadeInBitmapDisplayer(300)) .build(); setTitle(Constant.CATEGORY_TITLE); // Look up the AdView as a resource and load a request. mAdView = (AdView) findViewById(R.id.adView); mAdView.loadAd(new AdRequest.Builder().build()); Intent i = getIntent(); position = i.getIntExtra("POSITION_ID", 0); mAllImages = i.getStringArrayExtra("IMAGE_ARRAY"); mAllImageCatName = i.getStringArrayExtra("IMAGE_CATNAME"); TOTAL_IMAGE = mAllImages.length - 1; viewpager = (ViewPager) findViewById(R.id.image_slider); handler = new Handler(); PinchZoomPageAdapter adapter = new PinchZoomPageAdapter(this, mAllImages, mAllImageCatName); viewpager.setAdapter(adapter); viewpager.setCurrentItem(position); sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); lastUpdate = System.currentTimeMillis(); mCountPage = 0; mInterstitial = new InterstitialAd(this); mInterstitial.setAdUnitId(getResources().getString(R.string.admob_publisher_id)); request = new AdRequest.Builder().addTestDevice("7F0E780CC56F3BA7C1CA7488A61F46BE").build(); mInterstitial.loadAd(request); mInterstitial.setAdListener( new AdListener() { @Override public void onAdClosed() { mInterstitial.loadAd(request); } }); viewpager.setOnPageChangeListener( new OnPageChangeListener() { @Override public void onPageSelected(int position) { // TODO Auto-generated method stub mCountPage++; Log.d("haipn", "page count:" + mCountPage); if (mCountPage >= 20) { if (mInterstitial.isLoaded()) { mInterstitial.show(); mCountPage = 0; } } position = viewpager.getCurrentItem(); Image_Url = mAllImages[position]; List<Pojo> pojolist = db.getFavRow(Image_Url); if (pojolist.size() == 0) { menu.getItem(3).setIcon(getResources().getDrawable(R.drawable.fav)); } else { if (pojolist.get(0).getImageurl().equals(Image_Url)) { menu.getItem(3).setIcon(getResources().getDrawable(R.drawable.fav_hover)); } } } @Override public void onPageScrolled(int arg0, float arg1, int position) { // TODO Auto-generated method stub } @Override public void onPageScrollStateChanged(int position) { // TODO Auto-generated method stub } }); }
@Override public void onAdClosed() { // Proceed to the next level. startButton.setVisibility(View.VISIBLE); interstitialAd.loadAd(adRequest); }
private void loadInterstitial() { // Disable the next level button and load the ad. mNextLevelButton.setEnabled(false); AdRequest adRequest = new AdRequest.Builder().build(); mInterstitialAd.loadAd(adRequest); }
private void requestNewInterstitial() { AdRequest adRequest = new AdRequest.Builder().addTestDevice("SEE_YOUR_LOGCAT_TO_GET_YOUR_DEVICE_ID").build(); mInterstitialAd.loadAd(adRequest); }
private void requestNewInterstitial() { Log.d("YellowAndDangerous", "requestNewInterstitial"); AdRequest adRequest = new AdRequest.Builder().build(); mInterstitialAd.loadAd(adRequest); }
private void requestNewInterstitial() { AdRequest adRequest = new AdRequest.Builder().build(); mInterstitialAd.loadAd(adRequest); }