com.facebook.ads.AudienceNetworkAds Java Examples

The following examples show how to use com.facebook.ads.AudienceNetworkAds. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FacebookInitializer.java    From googleads-mobile-android-mediation with Apache License 2.0 6 votes vote down vote up
void initialize(Context context, ArrayList<String> placements, Listener listener) {
  if (mIsInitializing) {
    mListeners.add(listener);
    return;
  }

  if (mIsInitialized) {
    listener.onInitializeSuccess();
    return;
  }

  mIsInitializing = true;

  getInstance().mListeners.add(listener);
  AudienceNetworkAds.buildInitSettings(context)
      .withMediationService("GOOGLE:" + BuildConfig.VERSION_NAME)
      .withPlacementIds(placements)
      .withInitListener(FacebookInitializer.this)
      .initialize();
}
 
Example #2
Source File: FacebookInitializer.java    From googleads-mobile-android-mediation with Apache License 2.0 5 votes vote down vote up
@Override
public void onInitialized(AudienceNetworkAds.InitResult initResult) {
  mIsInitializing = false;
  mIsInitialized = initResult.isSuccess();

  for (Listener listener : mListeners) {
    if (initResult.isSuccess()) {
      listener.onInitializeSuccess();
    } else {
      listener.onInitializeError(initResult.getMessage());
    }
  }
  mListeners.clear();
}
 
Example #3
Source File: MainActivity.java    From Instagram-Profile-Downloader with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_main);
    AudienceNetworkAds.initialize(this);
    dataObjectRepositry = DataObjectRepositry.dataObjectRepositry;
    ButterKnife.bind(this);
    getSafeIntent();
    initUI();
    onClick();
    addToFirebase();


    interstitialAd = new InterstitialAd(this);
    interstitialAd.setAdUnitId(getString(R.string.interstitial_full_screen));
    AdRequest adRequest = new AdRequest.Builder().build();
    interstitialAd.loadAd(adRequest);

    allLoginUserList.clear();
    LiveData<List<Logins>> loggedInUsers = DataObjectRepositry.dataObjectRepositry.getAllUsers();
    loggedInUsers.observe(MainActivity.this, new Observer<List<Logins>>() {
        @Override
        public void onChanged(List<Logins> logins) {
            if (logins.size() > 0) {
                allLoginUserList.clear();
                for (Logins logins1 : logins) {

                    DrawerMenuPojo drawerMenuPojo1 = new DrawerMenuPojo();
                    drawerMenuPojo1.setMenuName(logins1.getUserName());
                    drawerMenuPojo1.setImage(R.drawable.ic_account);
                    allLoginUserList.add(drawerMenuPojo1);

                }
            }
        }
    });


    if (!TextUtils.isEmpty(user_id)) {

        showLoading();
        new GetUserInfo(user_id).execute();
    } else {

        changeFragment(new StoriesFragment());
        toolbar.setTitle("Stories");
    }
    toolbar.setTitle("Stories");
}
 
Example #4
Source File: Utils.java    From SmartFlasher with GNU General Public License v3.0 4 votes vote down vote up
public void initializeFaceBookAds(Context context) {
    if (Prefs.getBoolean("allow_ads", true, context)) {
        AudienceNetworkAds.initialize(context);
    }
}
 
Example #5
Source File: MainActivity.java    From SmartPack-Kernel-Manager with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Initialize FaceBook Ads
    if (Prefs.getBoolean("allow_ads", true, this)) {
        AudienceNetworkAds.initialize(this);
    }

    /*
     * Initialize Spectrum Profiles & Wakelock Blocker
     */
    if (RootUtils.rootAccess()) {
        if (Spectrum.supported()) {
            int Profile = Utils.strToInt(Spectrum.getProfile());
            Prefs.saveInt("spectrum_profile", Profile, this);
        }
        if (Wakelocks.boefflawlsupported()) {
            Wakelocks.CopyWakelockBlockerDefault();
        }
    }

    setContentView(R.layout.activity_main);

    View splashBackground = findViewById(R.id.splash_background);
    mRootAccess = findViewById(R.id.root_access_text);
    mBusybox = findViewById(R.id.busybox_text);
    mCollectInfo = findViewById(R.id.info_collect_text);

    /*
     * Hide huge banner in landscape mode
     */
    if (Utils.getOrientation(this) == Configuration.ORIENTATION_LANDSCAPE) {
        splashBackground.setVisibility(View.GONE);
    }

    if (savedInstanceState == null) {
        /*
         * Launch password activity when one is set,
         * otherwise run {@link CheckingTask}
         */
        String password;
        if (!(password = Prefs.getString("password", "", this)).isEmpty()) {
            Intent intent = new Intent(this, SecurityActivity.class);
            intent.putExtra(SecurityActivity.PASSWORD_INTENT, password);
            startActivityForResult(intent, 0);
        } else {
            new CheckingTask(this).execute();
        }
    }
}