use of org.prebid.mobile.ContentObject in project prebid-mobile-android by prebid.
the class HTMLCreative method createOmAdSession.
@Override
public void createOmAdSession() {
if (getCreativeView() == null || getCreativeView().getWebView() == null) {
LogUtil.error(TAG, "initOmAdSession error. Opex webView is null");
return;
}
OmAdSessionManager omAdSessionManager = mWeakOmAdSessionManager.get();
if (omAdSessionManager == null) {
LogUtil.error(TAG, "Error creating adSession. OmAdSessionManager is null");
return;
}
WebViewBase webView = getCreativeView().getWebView();
AdConfiguration adConfiguration = getCreativeModel().getAdConfiguration();
ContentObject contentObject = adConfiguration.getAppContent();
String contentUrl = null;
if (contentObject != null)
contentUrl = contentObject.getUrl();
omAdSessionManager.initWebAdSessionManager(webView, contentUrl);
startOmSession(omAdSessionManager, webView);
}
use of org.prebid.mobile.ContentObject in project prebid-mobile-android by prebid.
the class AppInfoParameterBuilderTest method testAppendBuilderParameters.
@Test
public void testAppendBuilderParameters() throws Exception {
AdConfiguration adConfiguration = new AdConfiguration();
ContentObject contentObject = new ContentObject();
contentObject.setUrl("test.com");
adConfiguration.setAppContent(contentObject);
AppInfoParameterBuilder builder = new AppInfoParameterBuilder(adConfiguration);
AdRequestInput adRequestInput = new AdRequestInput();
final String expectedStoreurl = "https://google.play.com";
final String expectedPublisherName = "prebid";
Targeting.setPublisherName(expectedPublisherName);
Targeting.setAppStoreMarketUrl(expectedStoreurl);
builder.appendBuilderParameters(adRequestInput);
BidRequest expectedBidRequest = new BidRequest();
final App expectedApp = expectedBidRequest.getApp();
expectedApp.name = APP_NAME;
expectedApp.bundle = APP_BUNDLE;
expectedApp.storeurl = expectedStoreurl;
expectedApp.getPublisher().name = expectedPublisherName;
expectedApp.getExt().put("prebid", Prebid.getJsonObjectForApp(BasicParameterBuilder.DISPLAY_MANAGER_VALUE, PrebidRenderingSettings.SDK_VERSION));
ContentObject expectedContentObject = new ContentObject();
expectedContentObject.setUrl("test.com");
expectedApp.contentObject = expectedContentObject;
assertEquals(expectedBidRequest.getJsonObject().toString(), adRequestInput.getBidRequest().getJsonObject().toString());
}
use of org.prebid.mobile.ContentObject in project prebid-mobile-android by prebid.
the class AppTest method getJsonObject.
@Test
public void getJsonObject() throws Exception {
App app = new App();
app.id = "appId";
app.name = "test";
app.bundle = "com.test.test";
app.domain = "com.us.prebid.net";
app.storeurl = "test.url.com";
app.cat = new String[] { "1", "2" };
app.sectioncat = new String[] { "1", "2" };
app.pagecat = new String[] { "1", "2" };
app.ver = "1";
app.privacypolicy = 1;
app.paid = 1;
app.keywords = "blah, blah";
app.getPublisher().name = "name";
ContentObject contentObject = new ContentObject();
contentObject.setUrl("test.content.com");
app.contentObject = contentObject;
JSONObject actualObj = app.getJsonObject();
String expectedString = "{\"ver\":\"1\",\"privacypolicy\":1,\"keywords\":\"blah, blah\",\"content\":{\"url\":\"test.content.com\"},\"sectioncat\":[\"1\",\"2\"],\"storeurl\":\"test.url.com\",\"domain\":\"com.us.prebid.net\",\"cat\":[\"1\",\"2\"],\"name\":\"test\",\"paid\":1,\"publisher\":{\"name\":\"name\"},\"id\":\"appId\",\"bundle\":\"com.test.test\",\"pagecat\":[\"1\",\"2\"]}";
assertEquals("got: " + actualObj.toString(), expectedString, actualObj.toString());
}
use of org.prebid.mobile.ContentObject in project prebid-mobile-android by prebid.
the class VideoCreative method createOmAdSession.
@Override
public void createOmAdSession() {
OmAdSessionManager omAdSessionManager = mWeakOmAdSessionManager.get();
if (omAdSessionManager == null) {
LogUtil.error(TAG, "Error creating AdSession. OmAdSessionManager is null");
return;
}
AdConfiguration adConfiguration = mModel.getAdConfiguration();
ContentObject contentObject = adConfiguration.getAppContent();
String contentUrl = null;
if (contentObject != null)
contentUrl = contentObject.getUrl();
omAdSessionManager.initVideoAdSession(mModel.getAdVerifications(), contentUrl);
startOmSession();
}
Aggregations