use of org.prebid.mobile.drprebid.model.DemandTestResults 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);
}
}
Aggregations