Search in sources :

Example 1 with PrebidServerSettings

use of org.prebid.mobile.drprebid.model.PrebidServerSettings in project prebid-mobile-android by prebid.

the class RealTimeDemandTest method startTest.

public void startTest() {
    GeneralSettings generalSettings = SettingsManager.getInstance(mContext).getGeneralSettings();
    PrebidServerSettings prebidServerSettings = SettingsManager.getInstance(mContext).getPrebidServerSettings();
    AdUnit adUnit = null;
    if (generalSettings.getAdFormat() == AdFormat.BANNER) {
        AdSize adSize = generalSettings.getAdSize();
        adUnit = new BannerAdUnit(prebidServerSettings.getConfigId(), adSize.getWidth(), adSize.getHeight());
    } else if (generalSettings.getAdFormat() == AdFormat.INTERSTITIAL) {
        adUnit = new InterstitialAdUnit(prebidServerSettings.getConfigId());
    }
    List<AdUnit> adUnits = Collections.singletonList(adUnit);
    String hostUrl;
    switch(prebidServerSettings.getPrebidServer()) {
        case APPNEXUS:
            PrebidMobile.setPrebidServerHost(Host.APPNEXUS);
            hostUrl = Constants.EndpointUrls.APPNEXUS_PREBID_SERVER;
            break;
        case RUBICON:
            PrebidMobile.setPrebidServerHost(Host.RUBICON);
            hostUrl = Constants.EndpointUrls.RUBICON_PREBID_SERVER;
            break;
        case CUSTOM:
            PrebidMobile.setPrebidServerHost(Host.CUSTOM);
            hostUrl = buildCustomServerEndpoint(prebidServerSettings.getCustomPrebidServerUrl());
            Host.CUSTOM.setHostUrl(hostUrl);
            break;
        default:
            PrebidMobile.setPrebidServerHost(Host.APPNEXUS);
            hostUrl = Constants.EndpointUrls.APPNEXUS_PREBID_SERVER;
    }
    DemandRequestBuilder builder = new DemandRequestBuilder(mContext, prebidServerSettings.getConfigId(), generalSettings.getAdSize());
    String request = builder.buildRequest(adUnits, prebidServerSettings.getAccountId(), true);
    testResponseCount = 0;
    testResults = new DemandTestResults(request);
    for (int i = 0; i < REQUEST_MAX; i++) {
        runTest(hostUrl, request, requestCompletionListener);
    }
}
Also used : PrebidServerSettings(org.prebid.mobile.drprebid.model.PrebidServerSettings) BannerAdUnit(org.prebid.mobile.BannerAdUnit) AdUnit(org.prebid.mobile.AdUnit) InterstitialAdUnit(org.prebid.mobile.InterstitialAdUnit) AdSize(org.prebid.mobile.drprebid.model.AdSize) DemandTestResults(org.prebid.mobile.drprebid.model.DemandTestResults) GeneralSettings(org.prebid.mobile.drprebid.model.GeneralSettings) BannerAdUnit(org.prebid.mobile.BannerAdUnit) InterstitialAdUnit(org.prebid.mobile.InterstitialAdUnit)

Example 2 with PrebidServerSettings

use of org.prebid.mobile.drprebid.model.PrebidServerSettings in project prebid-mobile-android by prebid.

the class PrebidServerSettingsViewholder method fillValues.

private void fillValues() {
    PrebidServerSettings settings = SettingsManager.getInstance(itemView.getContext()).getPrebidServerSettings();
    fillPrebidServer(settings.getPrebidServer());
    if (!TextUtils.isEmpty(settings.getAccountId())) {
        mAccountIdView.setText(settings.getAccountId());
    }
    if (!TextUtils.isEmpty(settings.getConfigId())) {
        mConfigIdView.setText(settings.getConfigId());
    }
}
Also used : PrebidServerSettings(org.prebid.mobile.drprebid.model.PrebidServerSettings)

Example 3 with PrebidServerSettings

use of org.prebid.mobile.drprebid.model.PrebidServerSettings in project prebid-mobile-android by prebid.

the class SubmitViewHolder method validateSettings.

private boolean validateSettings() {
    AdServerSettings adServerSettings = SettingsManager.getInstance(itemView.getContext()).getAdServerSettings();
    PrebidServerSettings prebidServerSettings = SettingsManager.getInstance(itemView.getContext()).getPrebidServerSettings();
    boolean valid = true;
    if (TextUtils.isEmpty(adServerSettings.getAdUnitId())) {
        valid = false;
    }
    if (adServerSettings.getBidPrice() <= 0.0) {
        valid = false;
    }
    if (prebidServerSettings.getPrebidServer() == PrebidServer.CUSTOM && TextUtils.isEmpty(prebidServerSettings.getCustomPrebidServerUrl())) {
        valid = false;
    }
    if (TextUtils.isEmpty(prebidServerSettings.getAccountId())) {
        valid = false;
    }
    if (TextUtils.isEmpty(prebidServerSettings.getConfigId())) {
        valid = false;
    }
    return valid;
}
Also used : PrebidServerSettings(org.prebid.mobile.drprebid.model.PrebidServerSettings) AdServerSettings(org.prebid.mobile.drprebid.model.AdServerSettings)

Example 4 with PrebidServerSettings

use of org.prebid.mobile.drprebid.model.PrebidServerSettings in project prebid-mobile-android by prebid.

the class SdkTest method setupPrebid.

private void setupPrebid() {
    GeneralSettings generalSettings = SettingsManager.getInstance(mContext).getGeneralSettings();
    PrebidServerSettings prebidServerSettings = SettingsManager.getInstance(mContext).getPrebidServerSettings();
    setPrebidTargetingParams();
    if (generalSettings.getAdFormat() == AdFormat.BANNER) {
        AdSize adSize = generalSettings.getAdSize();
        mAdUnit = new BannerAdUnit(prebidServerSettings.getConfigId(), adSize.getWidth(), adSize.getHeight());
    } else if (generalSettings.getAdFormat() == AdFormat.INTERSTITIAL) {
        mAdUnit = new InterstitialAdUnit(prebidServerSettings.getConfigId());
    }
    PrebidMobile.setPrebidServerAccountId(prebidServerSettings.getAccountId());
    switch(prebidServerSettings.getPrebidServer()) {
        case APPNEXUS:
            PrebidMobile.setPrebidServerHost(Host.APPNEXUS);
            break;
        case RUBICON:
            PrebidMobile.setPrebidServerHost(Host.RUBICON);
            break;
        case CUSTOM:
            PrebidMobile.setPrebidServerHost(Host.CUSTOM);
            Host.CUSTOM.setHostUrl(buildCustomServerEndpoint(prebidServerSettings.getCustomPrebidServerUrl()));
            break;
    }
    if (mListener != null) {
        mListener.onAdUnitRegistered();
    }
}
Also used : PrebidServerSettings(org.prebid.mobile.drprebid.model.PrebidServerSettings) AdSize(org.prebid.mobile.drprebid.model.AdSize) GeneralSettings(org.prebid.mobile.drprebid.model.GeneralSettings) BannerAdUnit(org.prebid.mobile.BannerAdUnit) InterstitialAdUnit(org.prebid.mobile.InterstitialAdUnit)

Example 5 with PrebidServerSettings

use of org.prebid.mobile.drprebid.model.PrebidServerSettings in project prebid-mobile-android by prebid.

the class PrebidServerDialog method fillValues.

private void fillValues() {
    PrebidServerSettings settings = SettingsManager.getInstance(getActivity()).getPrebidServerSettings();
    switch(settings.getPrebidServer()) {
        case APPNEXUS:
            mServerGroup.check(R.id.radio_appnexus);
            break;
        case RUBICON:
            mServerGroup.check(R.id.radio_rubicon);
            break;
        case CUSTOM:
            mServerGroup.check(R.id.radio_custom);
            mCustomServerField.setText(settings.getCustomPrebidServerUrl());
            break;
    }
}
Also used : PrebidServerSettings(org.prebid.mobile.drprebid.model.PrebidServerSettings)

Aggregations

PrebidServerSettings (org.prebid.mobile.drprebid.model.PrebidServerSettings)8 AdSize (org.prebid.mobile.drprebid.model.AdSize)3 GeneralSettings (org.prebid.mobile.drprebid.model.GeneralSettings)3 BannerAdUnit (org.prebid.mobile.BannerAdUnit)2 InterstitialAdUnit (org.prebid.mobile.InterstitialAdUnit)2 AdServerSettings (org.prebid.mobile.drprebid.model.AdServerSettings)2 Uri (android.net.Uri)1 FrameLayout (android.widget.FrameLayout)1 PublisherAdRequest (com.google.android.gms.ads.doubleclick.PublisherAdRequest)1 PublisherAdView (com.google.android.gms.ads.doubleclick.PublisherAdView)1 PublisherInterstitialAd (com.google.android.gms.ads.doubleclick.PublisherInterstitialAd)1 MoPubInterstitial (com.mopub.mobileads.MoPubInterstitial)1 MoPubView (com.mopub.mobileads.MoPubView)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Call (okhttp3.Call)1 Callback (okhttp3.Callback)1 MediaType (okhttp3.MediaType)1 OkHttpClient (okhttp3.OkHttpClient)1 Request (okhttp3.Request)1