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);
}
}
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());
}
}
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;
}
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();
}
}
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;
}
}
Aggregations