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

项目:admob-native-advanced-feed    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Initialize the Mobile Ads SDK.
    MobileAds.initialize(this, getString(R.string.admob_app_id));

    if (savedInstanceState == null) {
        // Create new fragment to display a progress spinner while the data set for the
        // RecyclerView is populated.
        Fragment loadingScreenFragment = new LoadingScreenFragment();
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        transaction.add(R.id.fragment_container, loadingScreenFragment);

        // Commit the transaction.
        transaction.commit();

        // Update the RecyclerView item's list with menu items.
        addMenuItemsFromJson();
        // Update the RecyclerView item's list with native ads.
        loadNativeAd();
    }
}
项目:BuddyBook    文件:App.java   
@Override
public void onCreate() {
    super.onCreate();

    if(BuildConfig.FLAVOR.equals(Constants.FLAVOR_FREE))
        MobileAds.initialize(getBaseContext(),getString(R.string.ad_app_id));

    JodaTimeAndroid.init(this);

    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
            .setDefaultFontPath("fonts/baskvl.ttf")
            .setFontAttrId(R.attr.fontPath)
            .build()
    );

}
项目:anitrend-app    文件:MainPresenter.java   
@Override
protected Boolean doInBackground(Void... voids) {
    FirebaseApp.initializeApp(mContext);
    MobileAds.initialize(mContext.getApplicationContext(), mContext.getResources().getString(R.string.app_id));
    FirebaseAnalytics.getInstance(mContext).setAnalyticsCollectionEnabled(true);
    FirebaseAnalytics.getInstance(mContext).setMinimumSessionDuration(2000);
    //dc.getGenres(null, null);

    AppVersionTracking current = new AppVersionTracking(BuildConfig.VERSION_CODE, BuildConfig.VERSION_NAME);

    if(!getAppPrefs().checkState()){
        getAppPrefs().saveOrUpdateVersionNumber(current);
        return false;
    }
    AppVersionTracking saved = getAppPrefs().getSavedVersions();
    if((BuildConfig.VERSION_CODE > saved.getCode())) {
        getAppPrefs().saveOrUpdateVersionNumber(current);
        return true;
    }
    return null;
}
项目:SaveIg    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    MobileAds.initialize(getApplicationContext(), getString(R.string.banner_ad_app_id));
    initializeAd();

    plSwitch = (PulsatorLayout) findViewById(R.id.pl_switch);
    findViewById(R.id.ib_switch).setOnClickListener(this);
    findViewById(R.id.iv_question).setOnClickListener(this);

    serviceRunning = isClipboardServiceRunning(ClipboardService.class);
    if (serviceRunning) {
        plSwitch.start();
    }
}
项目:fluffybalance    文件:AndroidLauncher.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Initialize the Mobile Ads SDK.
    MobileAds.initialize(this, APP_ID);

    AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
    cfg.useGyroscope = false;
    cfg.useCompass = true;
    cfg.useAccelerometer = true;

    // Do the stuff that initialize() would do for you
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);

    RelativeLayout layout = new RelativeLayout(this);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.MATCH_PARENT,
            RelativeLayout.LayoutParams.MATCH_PARENT);
    layout.setLayoutParams(params);

    AdView admobView = createAdView();
    layout.addView(admobView);
    View gameView = createGameView(cfg);
    layout.addView(gameView);

    setContentView(layout);
    startAdvertising(admobView);
}
项目:Weather4U    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mUserLocation = WeatherUtil.getPreferredLocation(this);
    if (findViewById(R.id.weather_detail_container) != null) {
        mIsTwoPane = true;
        if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction()
                    .replace(R.id.weather_detail_container, new DetailFragment(), DETAILFRAGMENT_TAG)
                    .commit();
        }
    } else {
        mIsTwoPane = false;
        getSupportActionBar().setElevation(8f);
    }
    WeatherForecastFragment forecastFragment = ((WeatherForecastFragment) getSupportFragmentManager()
            .findFragmentById(R.id.fragment_weather_forecast));
    forecastFragment.setUseTodayLayout(!mIsTwoPane);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    getSupportActionBar().setLogo(R.mipmap.ic_launcher);
    getSupportActionBar().setDisplayUseLogoEnabled(true);
    setTitle();
    Weather4USyncAdapter.initializeSyncAdapter(this);
    MobileAds.initialize(getApplicationContext(), getString(R.string.ad_mob_application_id));
}
项目: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();
        }
    }
项目:MoonlightNote    文件:LoginActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTransition();
    setContentView(R.layout.activity_login);
    // initialize Admob
    MobileAds.initialize(this, AD_UNIT_ID);
    mAuth = getInstance();

    boolean flag = SPUtils.getBoolean(this, Constants.USER_CONFIG, Constants.USER_CONFIG_AUTO_LOGIN, false);
    if (!flag) {
        signIn();
    }

    startAdFragment();
}
项目:MoonlightNote    文件:SlashFragment.java   
@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_slash, container, false);
        // initialize Admob
        MobileAds.initialize(mActivity, APP_ID);
        NativeExpressAdView adView = view.findViewById(R.id.adView);
        AdRequest request = new AdRequest.Builder()
//                .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
//                .addTestDevice("0ACA1878D607E6C4360F91E0A0379C2F")
//                .addTestDevice("4DA2263EDB49C1F2C00F9D130B823096")
                .build();
        adView.loadAd(request);
        if (!adView.isLoading()) {
            adView.setVisibility(View.GONE);
        }
        return view;
    }
项目:scroball    文件:ScroballApplication.java   
@Override
public void onCreate() {
  super.onCreate();
  Fabric.with(this, new Crashlytics());
  FlowManager.init(this);
  MobileAds.initialize(this, "ca-app-pub-9985743520520066~4279780475");

  sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

  String userAgent =
      String.format(Locale.UK, "%s.%d", BuildConfig.APPLICATION_ID, BuildConfig.VERSION_CODE);
  String sessionKeyKey = getString(R.string.saved_session_key);
  LastfmApi api = new LastfmApi();
  Caller caller = Caller.getInstance();

  if (sharedPreferences.contains(sessionKeyKey)) {
    String sessionKey = sharedPreferences.getString(sessionKeyKey, null);
    lastfmClient = new LastfmClient(api, caller, userAgent, sessionKey);
  } else {
    lastfmClient = new LastfmClient(api, caller, userAgent);
  }

  scroballDB = new ScroballDB();
  eventBus.register(this);
}
项目:android-ads    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Initialize the Mobile Ads SDK.
    MobileAds.initialize(this, ADMOB_APP_ID);

    mRefresh = findViewById(R.id.btn_refresh);
    mRequestAppInstallAds = findViewById(R.id.cb_appinstall);
    mRequestContentAds = findViewById(R.id.cb_content);
    mStartVideoAdsMuted = findViewById(R.id.cb_start_muted);
    mVideoStatus = findViewById(R.id.tv_video_status);

    mRefresh.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            refreshAd(mRequestAppInstallAds.isChecked(),
                    mRequestContentAds.isChecked());
        }
    });

    refreshAd(mRequestAppInstallAds.isChecked(),
            mRequestContentAds.isChecked());
}
项目:android-ads    文件:MyActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_my);

    // Initialize the Mobile Ads SDK.
    MobileAds.initialize(this, "ca-app-pub-3940256099942544~3347511713");

    // Gets the ad view defined in layout/ad_fragment.xml with ad unit ID set in
    // values/strings.xml.
    mAdView = findViewById(R.id.ad_view);

    // Create an ad request. Check your 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();

    // Start loading the ad in the background.
    mAdView.loadAd(adRequest);
}
项目:cordova-plugin-ad-admob    文件:AdMobOverlap.java   
public void loadRewardedVideoAd() {
    if (rewardedVideo == null) {
        //rewardedVideo = new RewardedVideoAd(plugin.getCordova().getActivity());
        rewardedVideo = MobileAds.getRewardedVideoAdInstance(plugin.getCordova().getActivity());
        //
        //rewardedVideo.setAdUnitId(this.rewardedVideoAdUnit);
        rewardedVideo.setRewardedVideoAdListener(new MyRewardedVideoListener());    
    }       

    AdRequest.Builder builder = new AdRequest.Builder();
    if(isTest) {
        builder.addTestDevice(AdRequest.DEVICE_ID_EMULATOR); 
        //builder.addTestDevice("INSERT_YOUR_HASHED_DEVICE_ID_HERE");               
        String ANDROID_ID = Settings.Secure.getString(plugin.getCordova().getActivity().getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
        String deviceId = Util.md5(ANDROID_ID).toUpperCase();
        builder.addTestDevice(deviceId);        
    }
    AdRequest request = builder.build();            
    rewardedVideo.loadAd(this.rewardedVideoAdUnit, request);        
}
项目:funcodetuts    文件:MainActivity.java   
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        MobileAds.initialize(getApplicationContext(), "YOUR UNIT ID");

        AdView adView = (AdView) this.findViewById(R.id.adMob);
        //request TEST ads to avoid being disabled for clicking your own ads
        AdRequest adRequest = new AdRequest.Builder()
                .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)// This is for emulators
                //test mode on DEVICE (this example code must be replaced with your device uniquq ID)
//                .addTestDevice("2EAB96D84FE62876379A9C030AA6A0AC") // Nexus 5
                .build();
        adView.loadAd(adRequest);
    }
项目:googleads-mobile-android-examples    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Initialize the Mobile Ads SDK.
    MobileAds.initialize(this, ADMOB_APP_ID);

    mRefresh = findViewById(R.id.btn_refresh);
    mRequestAppInstallAds = findViewById(R.id.cb_appinstall);
    mRequestContentAds = findViewById(R.id.cb_content);
    mStartVideoAdsMuted = findViewById(R.id.cb_start_muted);
    mVideoStatus = findViewById(R.id.tv_video_status);

    mRefresh.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            refreshAd(mRequestAppInstallAds.isChecked(),
                    mRequestContentAds.isChecked());
        }
    });

    refreshAd(mRequestAppInstallAds.isChecked(),
            mRequestContentAds.isChecked());
}
项目:googleads-mobile-android-examples    文件:MyActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_my);

    // Initialize the Mobile Ads SDK.
    MobileAds.initialize(this, "ca-app-pub-3940256099942544~3347511713");

    // Gets the ad view defined in layout/ad_fragment.xml with ad unit ID set in
    // values/strings.xml.
    mAdView = findViewById(R.id.ad_view);

    // Create an ad request. Check your 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();

    // Start loading the ad in the background.
    mAdView.loadAd(adRequest);
}
项目:FitBuddy    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    MobileAds.initialize(this, "ca-app-pub-3067141613739864~9851773284");

    ((FitbuddyApplication) getApplication()).getComponent().inject(this);

    Fragment workoutListFragment = new WorkoutListFragment();
    getSupportFragmentManager().beginTransaction()
            .add(R.id.fragment_content, workoutListFragment)
            .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
            .commit();

    bottomNavigation = findViewById(R.id.bottom_navigation);
    bottomNavigation.setOnNavigationItemSelectedListener(this);
}
项目:funcodetuts    文件:MainActivity.java   
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        MobileAds.initialize(getApplicationContext(), "YOUR UNIT ID");

        AdView adView = (AdView) this.findViewById(R.id.adMob);
        //request TEST ads to avoid being disabled for clicking your own ads
        AdRequest adRequest = new AdRequest.Builder()
                .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)// This is for emulators
                //test mode on DEVICE (this example code must be replaced with your device uniquq ID)
//                .addTestDevice("2EAB96D84FE62876379A9C030AA6A0AC") // Nexus 5
                .build();
        adView.loadAd(adRequest);
    }
项目: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());
}
项目:justintrain-client-android    文件:Ads.java   
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);
}
项目:justintrain-client-android    文件:Ads.java   
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);
}
项目:TibetanPersonalityTest    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    MobileAds.initialize(this, getString(R.string.appId));

    Intent i= new Intent(this, Introduction.class);
    this.finish();
    this.startActivity(i);
}
项目:TibetanPersonalityTest    文件:Introduction.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);

        String title1 = getString(R.string.title1);
        String description1 = getString(R.string.des1);
        int img1 = R.drawable.dalai_lama;
        int color1 = Color.rgb(92, 107, 192);

        String title2 = getString(R.string.title2);
        String description2 = getString(R.string.des2);
        int img2 = R.drawable.questions;
        int color2 = Color.rgb(76, 175, 80);

        String title3 = getString(R.string.title3);
        String description3 = getString(R.string.des3);
        int img3 = R.drawable.wish;
        int color3 = Color.rgb(11, 134, 235);


        addSlide(AppIntroFragment.newInstance(title1, description1, img1, color1));
        addSlide(AppIntroFragment.newInstance(title2, description2, img2, color2));
        addSlide(AppIntroFragment.newInstance(title3, description3, img3, color3));

        showSkipButton(false);
        setProgressButtonEnabled(true);


        MobileAds.initialize(this, getString(R.string.appId));

    }
项目:GodotFireBase    文件:AdMob.java   
public void init (FirebaseApp firebaseApp) {
    mFirebaseApp = firebaseApp;

    AdMobConfig = FireBase.getConfig().optJSONObject("Ads");
    MobileAds.initialize(activity, AdMobConfig.optString("AppId"));

    if (AdMobConfig.optBoolean("BannerAd", false)) { createBanner(); }
    if (AdMobConfig.optBoolean("InterstitialAd", false)) { createInterstitial(); }
    if (AdMobConfig.optBoolean("RewardedVideoAd", false)) {
        reward_ads = new HashMap<String, RewardedVideoAd>();

        String ad_unit_id = AdMobConfig.optString("RewardedVideoAdId", "");
        List<String> ad_units = new ArrayList<String>();

        if (ad_unit_id.length() <= 0) {
            Utils.d("AdMob:RewardedVideo:UnitId:NotProvided");
            ad_units.add(activity.getString(R.string.rewarded_video_ad_unit_id));
        } else {
            ad_units = Arrays.asList(ad_unit_id.split(","));
            Utils.d("AdMob:RewardedVideo:" +
            String.valueOf(ad_units.size()) +":UnitIdS:Found");
        }

        for (String id : ad_units) {
            RewardedVideoAd mrv = createRewardedVideo(id);
            requestNewRewardedVideo(mrv, id);

            reward_ads.put(id, mrv);
        }
    }

    mAdSize = new Dictionary();
    mAdSize.put("width", 0);
    mAdSize.put("height", 0);
}
项目:CodeWatch    文件:App.java   
@Override
public void onCreate() {
    super.onCreate();

    if (BuildConfig.DEBUG) {
        Timber.plant(new Timber.DebugTree());
    }
    FirebaseDatabase.getInstance().setPersistenceEnabled(true);
    MobileAds.initialize(getApplicationContext(),getString(R.string.banner_ad_unit_id));

    CacheUtils.updateAppUsage(this);
}
项目:text_converter    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (!Premium.isPremium(this)) {
        MobileAds.initialize(this);
    }
    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
    mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);

    setContentView(R.layout.activity_main);
    bindView();
    setupToolbar();
    showDialogRate();
    checkLicense();
}
项目:Boookito-Capstone-Project    文件:BookitoApp.java   
@Override
public void onCreate() {
  super.onCreate();

  FirebaseRepo.getInstance().setContext(this);
  FirebaseRepo.getInstance().setFirebaseAnalytics(FirebaseAnalytics.getInstance(this));
  MobileAds.initialize(getApplicationContext(), "ca-app-pub-5949676227120501~8601500878");
}
项目: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() {

        }
    });

}
项目:True-Weather    文件:ShowWeather.java   
private void init() {
    backup = new Backup(this);
    backupData = new BackupData();

    MobileAds.initialize(getApplicationContext(), getString(R.string.app_id));


    singleRL.setVisibility(View.GONE);
    doubleRL.setVisibility(View.GONE);
    cityTv.setText("Select Location");
    dateTv.setText(new Date().toString());
    huAndWSLL.setVisibility(View.GONE);
    notConfiguredRL.setVisibility(View.GONE);

    menuIB.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent settingIn = new Intent(ShowWeather.this, Setting.class);
            ShowWeather.this.startActivity(settingIn);
        }
    });


    blurRBV.setBlurRadius(BLUR_LOWER);
    //blurRBV.setOverlayColor(Const.getAIColor());


    syncData();
}
项目:Lunary-Ethereum-Wallet    文件:FragmentWallets.java   
@Override
public void adHandling(View rootView) {
    // Ads
    if (((AnalyticsApplication) ac.getApplication()).isGooglePlayBuild()) {
        AdView mAdView = (AdView) rootView.findViewById(R.id.adView);
        if (Settings.displayAds) {
            MobileAds.initialize(ac, "ca-app-pub-8285849835347571~6235180375");
            AdRequest adRequest = new AdRequest.Builder().build();
            mAdView.loadAd(adRequest);
        } else {
            mAdView.setVisibility(View.GONE);
        }
    }
}
项目:Lunary-Ethereum-Wallet    文件:AdRecyclerHolder.java   
void loadAd(Context c){
    if(c == null) return;
    if (Settings.displayAds) {
        MobileAds.initialize(c, "ca-app-pub-8285849835347571~6235180375");
        AdRequest adRequest = new AdRequest.Builder().build();
        ad.loadAd(adRequest);
    }
}
项目:WiFiView    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // addresses
    mAdView = (AdView) findViewById(R.id.adView);
    mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swiperefresh);

    // ads
    MobileAds.initialize(this, "ca-app-pub-9646303341923759~9003031985");
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);

    requestPermissions(new String[] { android.Manifest.permission.READ_EXTERNAL_STORAGE,
            android.Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA }, 1);
    show_list();

    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            mSwipeRefreshLayout.setRefreshing(true);
            refreshItems();
        }
    });

}
项目:WiFiView    文件:RestoreActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_restore);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowHomeEnabled(true);

    // address
    mAdView = (AdView) findViewById(R.id.adView1);
    mText = (TextView) findViewById(R.id.textView);
    mList = (ListView) findViewById(R.id.list1);
    mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swiperefresh1);

    // ads
    MobileAds.initialize(this, "ca-app-pub-9646303341923759~9003031985");
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);

    show_list();

    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            mSwipeRefreshLayout.setRefreshing(true);
            refreshItems();
        }
    });

}
项目:treehugger    文件:MyMapFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    getActivity().setTitle(getString(R.string.title_activity_maps));
    view = inflater.inflate(R.layout.fragment_map, container, false);

    FragmentManager fm = getFragmentManager();

    boolean refresh = true;
    if(savedInstanceState!=null)
        refresh=false;

    MapFragment fr = (MapFragment) fm.findFragmentById(R.id.map);
    if(fr==null||refresh) {
        fr = MapFragment.newInstance();
        fm.beginTransaction().replace(R.id.map, fr).commit();
        moveCamera = true;
    } else {
        moveCamera = false;
    }

    MobileAds.initialize(this.getActivity(), this.getResources().getString(R.string.unit_id));

    AdView mAdView = (AdView) view.findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();
    mAdView.loadAd(adRequest);

    fr.getMapAsync(this);

    return view;
}
项目:treehugger    文件:HeatMapFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    getActivity().setTitle(getString(R.string.title_activity_heat_maps));

    view = inflater.inflate(R.layout.fragment_heat_map, container, false);

    FragmentManager fm = getFragmentManager();

    boolean refresh = true;
    if(savedInstanceState!=null)
        refresh=false;

    MapFragment fr = (MapFragment) fm.findFragmentById(R.id.mapview);
    if(fr==null||refresh) {
        fr = MapFragment.newInstance();
        fm.beginTransaction().replace(R.id.mapview, fr).commit();
        moveCamera = true;
    } else {
        moveCamera = false;
    }

    MobileAds.initialize(this.getActivity(), this.getResources().getString(R.string.unit_id));
    AdView mAdView = (AdView) view.findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();
    mAdView.loadAd(adRequest);

    fr.getMapAsync(this);
    return view;
}
项目:GitHubSearch    文件:App.java   
@Override
public void onCreate() {
    super.onCreate();
    LeakCanary.install(this);
    sInstance = this;
    MobileAds.initialize(getApplicationContext(), BuildConfig.ADMOB_APP_ID);


    sModelLocator = new ModelLocator();
}
项目:gito-github-client    文件:TrafficAdActivity.java   
@Override
protected void onResume() {
    super.onResume();
    AdView adView = (AdView) findViewById(R.id.adView);
    MobileAds.initialize(getApplicationContext(),
            "ca-app-pub-6820123979073037~3030459702");
    AdRequest adRequest = new AdRequest.Builder().build();
    if (adView != null) {
        adView.loadAd(adRequest);
    } else {
        Log.e(TrafficActivity.class.getSimpleName(), "Ad view is not specified.");
    }
}
项目:TvAppRepo    文件:GenerateShortcutHelper.java   
static void showVideoAd(Activity activity) {
    final RewardedVideoAd ad = MobileAds.getRewardedVideoAdInstance(activity);
    ad.setRewardedVideoAdListener(new RewardedVideoAdListener() {
        @Override
        public void onRewardedVideoAdLoaded() {
            ad.show();
        }

        @Override
        public void onRewardedVideoAdOpened() {

        }

        @Override
        public void onRewardedVideoStarted() {

        }

        @Override
        public void onRewardedVideoAdClosed() {

        }

        @Override
        public void onRewarded(RewardItem rewardItem) {

        }

        @Override
        public void onRewardedVideoAdLeftApplication() {

        }

        @Override
        public void onRewardedVideoAdFailedToLoad(int i) {

        }
    });
    ad.loadAd(activity.getString(R.string.reward_video_ad_unit_id), new AdRequest.Builder().build());
}