Search in sources :

Example 1 with ContentObject

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);
}
Also used : OmAdSessionManager(org.prebid.mobile.rendering.session.manager.OmAdSessionManager) WebViewBase(org.prebid.mobile.rendering.views.webview.WebViewBase) PrebidWebViewBase(org.prebid.mobile.rendering.views.webview.PrebidWebViewBase) ContentObject(org.prebid.mobile.ContentObject)

Example 2 with ContentObject

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());
}
Also used : App(org.prebid.mobile.rendering.models.openrtb.bidRequests.App) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) ContentObject(org.prebid.mobile.ContentObject) BidRequest(org.prebid.mobile.rendering.models.openrtb.BidRequest) Test(org.junit.Test)

Example 3 with ContentObject

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());
}
Also used : JSONObject(org.json.JSONObject) ContentObject(org.prebid.mobile.ContentObject) Test(org.junit.Test)

Example 4 with ContentObject

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();
}
Also used : OmAdSessionManager(org.prebid.mobile.rendering.session.manager.OmAdSessionManager) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) ContentObject(org.prebid.mobile.ContentObject)

Aggregations

ContentObject (org.prebid.mobile.ContentObject)4 Test (org.junit.Test)2 AdConfiguration (org.prebid.mobile.rendering.models.AdConfiguration)2 OmAdSessionManager (org.prebid.mobile.rendering.session.manager.OmAdSessionManager)2 JSONObject (org.json.JSONObject)1 BidRequest (org.prebid.mobile.rendering.models.openrtb.BidRequest)1 App (org.prebid.mobile.rendering.models.openrtb.bidRequests.App)1 PrebidWebViewBase (org.prebid.mobile.rendering.views.webview.PrebidWebViewBase)1 WebViewBase (org.prebid.mobile.rendering.views.webview.WebViewBase)1