Java 类com.google.android.gms.ads.InterstitialAd 实例源码

项目:BTNotifierAndroid    文件:WelcomeActivity.java   
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

}
项目:text_converter    文件:AdsManager.java   
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();
            }
        }
    });
}
项目:CuYemek    文件:CafeteriasFragment.java   
@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;
}
项目:True-Weather    文件:AdBhai.java   
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;
}
项目:Ad-Mob    文件:SecondActivity.java   
@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();
        }
    });
}
项目:Build-it-Bigger    文件:MainFragment.java   
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();
}
项目:pubnative-android-sdk    文件:AdMobInterstitialAdAdapter.java   
@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));
        }
    }
}
项目:USB_Mass_Storage_Enabler    文件:MainActivity.java   
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();
        }
    }
项目:BuildItBigger    文件:MainActivityFragment.java   
@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();
}
项目:FixMath    文件:PlayActivity.java   
boolean showIntersitialAdOnNextLevel(InterstitialAd intersitialAdOnNextLevel, int actualLevel) {
    if (actualLevel % 2 == 0) {
        if (intersitialAdOnNextLevel.isLoaded()) {
            intersitialAdOnNextLevel.show();
            return true;
        } else {
            return false;
        }
    }else{
        return false;
    }


}
项目:android-gradle-java-app-template    文件:PlaceholderFragment.java   
@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;
}
项目:hack.chat-android    文件:HackChatInterstitialAd.java   
/**
 * 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();
}
项目:marsTemp    文件:MainActivity.java   
/**
 * 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);
}
项目:GooglePlayServiceLocationSupport    文件:FragmentLocationActivity.java   
@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);
}
项目:Android_ApplicationTemplate    文件:MainActivity.java   
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();
            }
        }
    });

}
项目:2048-Battles    文件:GameActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_game);

       if (mHelper == null) {
           getGameHelper();
       }

       // Create the interstitial ad.
       interstitial = new InterstitialAd(this);
       interstitial.setAdUnitId(getString(R.string.interstitial_ad_unit_id));
       AdRequest adRequest = new AdRequest.Builder()
               .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
               .addTestDevice(getString(R.string.test_device_id))
               .build();

       // Begin loading the interstitial ad. It is not show until the game is isGameLost.
       interstitial.loadAd(adRequest);
}
项目:YouTubePlayerActivity    文件:AdHelper.java   
public static void popUpAd(Context context) {
    final InterstitialAd interstitialAd = getInstance(context);
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice("BE5D7D1E701EF21AB93369A353CAA3ED")
            .addTestDevice("921DF5A672991967B9FFE364D0FF8498")
            .addTestDevice("A642C45F5DD4C0E09AA896DDABD36789")
            .addTestDevice("5270E2092AA1F46AC51964363699AB9E")
            .build();
    interstitialAd.loadAd(adRequest);
    interstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdLoaded() {
            super.onAdLoaded();
            interstitialAd.show();
        }
    });
}
项目:android-dim-block    文件:Admob.java   
public static void initAd(final Context context) {
    if (isAbmobEnabled()) {
        // Create the interstitial.
        sInterstitialAd = new InterstitialAd(context);
        sInterstitialAd.setAdUnitId(Model.getInstance().getConfiguration().getAdmobId());

        // Create ad request.
        final AdRequest adRequest = new AdRequest.Builder().build();

        // Begin loading your interstitial.
        sInterstitialAd.loadAd(adRequest);

        sInterstitialAd.setAdListener(new AdListener() {
            @Override
            public void onAdLoaded() {
                displayInterstitial();
            }
        });
    }
}
项目:ANEAdMob    文件:AdMobManager.java   
public void cacheInterstitial(String adID, String testDevice)
{
    //Log.d("SOLITAIRE", "CACHE");

    _interstitial = new InterstitialAd(_act);
    _interstitial.setAdUnitId(adID);

    AdRequest adRequest = null;
    if(testDevice == null) //no test device
        adRequest = new AdRequest.Builder().build();
    else
        adRequest = new AdRequest.Builder().addTestDevice(testDevice).build(); //eto pizdec

    _interstitial.loadAd(adRequest);
    _interstitial.setAdListener(new AdMobListener(_ctx, "INTERSTITIAL"));
}
项目:mobile-sdk-android    文件:GooglePlayServicesInterstitial.java   
@Override
public void requestAd(MediatedInterstitialAdViewController mIC, Activity activity,
                      String parameter, String adUnitId, TargetingParameters targetingParameters) {
    adListener = new GooglePlayAdListener(mIC, super.getClass().getSimpleName());
    adListener.printToClog(String.format(" - requesting an ad: [%s, %s]", parameter, adUnitId));

    interstitialAd = new InterstitialAd(activity);
    interstitialAd.setAdUnitId(adUnitId);
    interstitialAd.setAdListener(adListener);

    try {
        interstitialAd.loadAd(buildRequest(targetingParameters));
    } catch (NoClassDefFoundError e) {
        // This can be thrown by Play Services on Honeycomb.
        adListener.onAdFailedToLoad(AdRequest.ERROR_CODE_NO_FILL);
    }
}
项目:javocsoft-toolbox    文件:AdInterstitial.java   
/**
 * Shows a new interstitial.
 *
 * @param admobAdID    Your AdMob interstitial id.
 * @param activity
 * @param clickCallback See {@link es.javocsoft.android.lib.toolbox.ads.InterstitialAdsListener.OnInterstitialClickCallback}
 * @return
 */
public InterstitialAd requestInterstitial(String admobAdID, Activity activity, InterstitialAdsListener.OnInterstitialClickCallback clickCallback) {
    Log.i(ToolBox.TAG, "Ads: Preparing a new interstitial.");

    // Create the interstitial.
    InterstitialAd interstitial = new InterstitialAd(activity.getApplicationContext());
    interstitial.setAdUnitId(admobAdID);

    AdRequest adRequest = interstitialAdRequest(interstitial, activity);
    if(adRequest!=null) {
        interstitial.loadAd(adRequest);
        interstitial.setAdListener(new InterstitialAdsListener(interstitial, clickCallback));
    }

    return interstitial;
}
项目:SnakeWear    文件:MainActivity.java   
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());
}
项目:1946    文件:GooglePlayServicesExtension.java   
private void initInterstitial()
{

    interstitialAd = new InterstitialAd(RunnerActivity.CurrentActivity);
    interstitialAd.setAdUnitId(InterstitialId);

    interstitialAd.setAdListener(adlistener);
}
项目:TibetanPersonalityTest    文件:Result.java   
@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();
        }
    });

}
项目:GodotFireBase    文件:AdMob.java   
public void createInterstitial() {
    if (AdMobConfig == null) { return; }

    String ad_unit_id = AdMobConfig.optString("InterstitialAdId", "");

    if (ad_unit_id.length() <= 0) {
        Utils.d("AdMob:Interstitial:UnitId:NotProvided");
        ad_unit_id = activity.getString(R.string.interstitial_ad_unit_id);
    }

    mInterstitialAd = new InterstitialAd(activity);
    mInterstitialAd.setAdUnitId(ad_unit_id);
    mInterstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdLoaded() {
            Utils.d("AdMob:Interstitial:OnAdLoaded");
            Utils.callScriptFunc("AdMob", "AdMob_Interstitial", "loaded");
        }

        @Override
        public void onAdFailedToLoad(int errorCode) {
            Utils.w("AdMob:Interstitial:onAdFailedToLoad:" + errorCode);
            Utils.callScriptFunc("AdMob", "AdMob_Interstitial", "load_failed");
        }

        @Override
        public void onAdClosed() {
            Utils.w("AdMob:Interstitial:onAdClosed");
            Utils.callScriptFunc("AdMob", "AdMob_Interstitial", "closed");
            requestNewInterstitial();
        }
    });

    requestNewInterstitial();
}
项目:ascii_generate    文件:MainActivity.java   
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());
    }
}
项目:easyfilemanager    文件:AdWrapper.java   
private void init(Context context) {
    //Ads
    if(!isTelevision()){
        LayoutInflater.from(context).inflate(R.layout.ads_wrapper, this, true);
        initAd();
    } else {
        mInterstitialAd = new InterstitialAd(context);
        initInterstitialAd();
    }
}
项目:WarningSystemWeather-Android-App    文件:ListFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_list, container, false);

    mListView = (ListView) view.findViewById(android.R.id.list); // or getListView()
    mProgressBar = (ProgressBar) view.findViewById(R.id.progressBarMainScreen);
    mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipeContainer);
    mNoWarningTextView = (TextView) view.findViewById(R.id.noWarningTextView);


    if (isNetworkAvailable()) {
        grabData();
    }

    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            if (isNetworkAvailable()) {
                grabData();
                showAds();
                mSwipeRefreshLayout.setRefreshing(false);

            } else {
                mSwipeRefreshLayout.setRefreshing(false);
                mListView.setAdapter(null);
            }
        }
    });

    isItTimeToShowAds = 0;
    mInterstitialAd = new InterstitialAd(getActivity());
    mInterstitialAd.setAdUnitId(getString(R.string.interstitial_ad_unit_id_for_test));


    return view;
}
项目:chat-sdk-android-push-firebase    文件:ChatSDKMainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    exitHelper = new ExitHelper(this);

    if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) {
        // Activity was brought to front and not created,
        // Thus finishing this will get us to the last viewed activity
        finish();
        return;
    }

    setContentView(R.layout.chat_sdk_activity_view_pager);

    firstTimeInApp();
    initViews();

    enableCheckOnlineOnResumed(true);

    if (!fromLoginActivity && savedInstanceState != null)
    {
        pager.setCurrentItem(savedInstanceState.getInt(PAGE_ADAPTER_POS));
    }

    mOpenFromPushChecker = new OpenFromPushChecker();
    if(mOpenFromPushChecker.checkOnCreate(getIntent(), savedInstanceState))
    {
        startChatActivityForID(getIntent().getExtras().getLong(ChatSDKAbstractChatActivity.THREAD_ID));
        return;
    }

    //// Added by zhang for interstitial ADS
    MobileAds.initialize(this, "ca-app-pub-2734020869575782/3654782558");

    mInterstitialAd = new InterstitialAd(this);
    mInterstitialAd.setAdUnitId(getString(R.string.full_ad_unit_id));

    mInterstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdLoaded(){
            super.onAdLoaded();
            if (mInterstitialAd.isLoaded())
                mInterstitialAd.show();
        }

        @Override
        public void onAdClosed() {

        }
    });

}
项目:IdealMedia    文件:NavigationActivity.java   
private void requestInterstitial() {
    if (Settings.PREMIUM || hasPremiumPurchase())
        return;

    if (!Settings.INTERSTITIAL_ENABLED)
        return;

    Date lastInterstitialDate = new Date(PreferenceManager.getDefaultSharedPreferences(this).getLong(getString(R.string.key_interstitial_date), 0));
    if (lastInterstitialDate.getTime() + 1000 * 60 * 60 * 24 * 7 < new Date().getTime()) {
        interstitial = new InterstitialAd(this);
        interstitial.setAdUnitId(getString(R.string.admob_interstitial));
        AdRequest adRequest = new AdRequest.Builder().build();
        interstitial.loadAd(adRequest);
    }
}
项目:2048-TimeKiller    文件:Game.java   
private void initAds() {
    AdRequest adRequest = new AdRequest.Builder().build();
    adView.loadAd(adRequest);

    //Interstitial Ad
    undoB.setVisibility(View.GONE);
    breakB.setVisibility(View.GONE);
    mInterAd = new InterstitialAd(this);
    mInterAd.setAdUnitId(getResources().getString(R.string.interstitial_button));
    mInterAd.loadAd(new AdRequest.Builder().build());
    mInterAd.setAdListener(new AdListener() {
        @Override
        public void onAdLoaded() {
            super.onAdLoaded();
            undoB.setVisibility(View.VISIBLE);
            breakB.setVisibility(View.VISIBLE);
        }

        @Override
        public void onAdClosed() {
            super.onAdClosed();
            undoB.setVisibility(View.GONE);
            breakB.setVisibility(View.GONE);
            mInterAd.loadAd(new AdRequest.Builder().build());
        }
    });
}
项目:B4A_FirebaseAdMob    文件:AdViewWrapper.java   
/**
 * Initializes the object.
 *EventName - Set the subs that will handle the events.
 *AdUnitId - The ad unit id. Test id: ca-app-pub-3940256099942544/1033173712
 */
public void Initialize(final BA ba, String EventName, String AdUnitId) {
    final String eventName = EventName.toLowerCase(BA.cul);
    InterstitialAd ad = new InterstitialAd(ba.context);
    ad.setAdUnitId(AdUnitId);
    ad.setAdListener(new AdListener() {

        @Override
        public void onAdClosed() {
            ba.raiseEventFromDifferentThread(getObject(), null, 0, eventName + "_adclosed", false, null);
        }
        @Override
        public void onAdFailedToLoad(int arg0) {
            ba.raiseEventFromDifferentThread(getObject(), null, 0, eventName + "_failedtoreceivead", false, new Object[] {String.valueOf(arg0)});
        }
        @Override
        public void onAdLeftApplication() {
            ba.raiseEventFromDifferentThread(getObject(), null, 0, eventName + "_adleftapplication", false, null);
        }
        @Override
        public void onAdOpened() {
            ba.raiseEventFromDifferentThread(getObject(), null, 0, eventName + "_adopened", false, null);
        }
        @Override
        public void onAdLoaded() {
            ba.raiseEventFromDifferentThread(getObject(), null, 0, eventName + "_receivead", false, null);
        }
    });
    setObject(ad);

}
项目:CouponsTracker    文件:ContainerActivity.java   
private void initInterstitialAd() {
    DebugLog.logMethod();
    interstitialAd = new InterstitialAd(this);
    interstitialAd.setAdUnitId(getString(R.string.interstitial_ad_unit_id));
    interstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdClosed() {
            DebugLog.logMethod();
            ContainerActivity.this.finish();
        }
    });
    requestNewInterstitial();
}
项目:FireFiles    文件:AdWrapper.java   
private void init(Context context) {
    //Ads
    if(!isTelevision()){
        LayoutInflater.from(context).inflate(R.layout.ads_wrapper, this, true);
        initAd();
    } else {
        mInterstitialAd = new InterstitialAd(context);
        initInterstitialAd();
    }
}
项目:simple-share-android    文件:AdWrapper.java   
private void init(Context context) {
    //Ads
    if(!isTelevision()){
        LayoutInflater.from(context).inflate(R.layout.ads_wrapper, this, true);
        initAd();
    } else {
        mInterstitialAd = new InterstitialAd(context);
        initInterstitialAd();
    }
}
项目:GodotAds    文件:AdMob.java   
public void createInterstitial() {
    String ad_unit_id = _config.optString("InterstitialAdId", "");

    if (ad_unit_id.length() <= 0) {
        Utils.d("AdMob:Interstitial:UnitId:NotProvided");
        ad_unit_id = activity.getString(R.string.interstitial_ad_unit_id);
    }

    mInterstitialAd = new InterstitialAd(activity);
    mInterstitialAd.setAdUnitId(ad_unit_id);
    mInterstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdLoaded() {
            Utils.d("AdMob:Interstitial:OnAdLoaded");
            Utils.callScriptFunc("AdMob", "AdMob_Interstitial", "loaded");
        }

        @Override
        public void onAdFailedToLoad(int errorCode) {
            Utils.w("AdMob:Interstitial:onAdFailedToLoad:" + errorCode);
            Utils.callScriptFunc("AdMob", "AdMob_Interstitial", "load_failed");
        }

        @Override
        public void onAdClosed() {
            Utils.w("AdMob:Interstitial:onAdClosed");
            requestNewInterstitial();
        }

    });

    requestNewInterstitial();
}
项目:Weather4U    文件:WeatherForecastFragment.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Add this line in order for this fragment to handle menu events.
    setHasOptionsMenu(true);
    //Following code sets up a listener for the change color with weather setting and notifies
    // the Forecast Adapter accordingly
    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getContext());
    mPreferenceChangeListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
        public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
            if (key.equals(PREF_ENABLE_COLOR_CHANGE_KEY)) {
                mWeatherForecastAdapter.notifyDataSetChanged();
            }

        }
    };
    preferences.registerOnSharedPreferenceChangeListener(mPreferenceChangeListener);
    mInterstitialAd = new InterstitialAd(getActivity());
    mInterstitialAd.setAdUnitId("ca-app-pub-3940256099942544/1033173712");
    mInterstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdClosed() {
            requestNewInterstitial();
        }
    });
    requestNewInterstitial();
}
项目:BusyBox    文件:MainActivity.java   
private void showTabInterstitials() {
    if (interstitialsTabAd != null) {
        for (InterstitialAd interstitialAd : interstitialsTabAd) {
            if (interstitialIsReady(interstitialAd)) {
                interstitialAd.show();
                return;
            }
        }
    }
}
项目:BusyBox    文件:MainActivity.java   
private void showSettingsInterstitials() {
    if (interstitialsSettingsAd != null) {
        for (InterstitialAd interstitialAd : interstitialsSettingsAd) {
            if (interstitialIsReady(interstitialAd)) {
                interstitialAd.show();
                return;
            }
        }
        startActivity(new Intent(this, SettingsActivity.class));
    }
}
项目:BusyBox    文件:MainActivity.java   
private void showInstallInterstitials() {
    if (interstitialsInstallAd != null) {
        for (InterstitialAd interstitialAd : interstitialsInstallAd) {
            if (interstitialIsReady(interstitialAd)) {
                interstitialAd.show();
                Analytics.newEvent("interstitial_ad").put("id", interstitialAd.getAdUnitId()).log();
                return;
            }
        }
    }
}