Search in sources :

Example 21 with AdSize

use of org.prebid.mobile.rendering.bidding.data.AdSize in project prebid-mobile-android by prebid.

the class BasicParameterBuilderTest method whenAppendParametersAndUseExternalBrowserFalseAndBrowserActivityAvailable_ClickBrowserEqualsZero.

@Test
public void whenAppendParametersAndUseExternalBrowserFalseAndBrowserActivityAvailable_ClickBrowserEqualsZero() {
    AdConfiguration adConfiguration = new AdConfiguration();
    adConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.BANNER);
    adConfiguration.addSize(new AdSize(320, 50));
    PrebidRenderingSettings.useExternalBrowser = false;
    BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, mContext.getResources(), mBrowserActivityAvailable);
    AdRequestInput adRequestInput = new AdRequestInput();
    builder.appendBuilderParameters(adRequestInput);
    Imp actualImp = adRequestInput.getBidRequest().getImp().get(0);
    assertEquals(0, actualImp.clickBrowser.intValue());
}
Also used : AdSize(org.prebid.mobile.rendering.bidding.data.AdSize) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) BasicParameterBuilder(org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder) Imp(org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp) Test(org.junit.Test)

Example 22 with AdSize

use of org.prebid.mobile.rendering.bidding.data.AdSize in project prebid-mobile-android by prebid.

the class BasicParameterBuilderTest method whenAppendParametersAndCoppaFalse_CoppaNull.

@Test
public void whenAppendParametersAndCoppaFalse_CoppaNull() {
    AdConfiguration adConfiguration = new AdConfiguration();
    adConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.BANNER);
    adConfiguration.addSize(new AdSize(320, 50));
    BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, mContext.getResources(), mBrowserActivityAvailable);
    AdRequestInput adRequestInput = new AdRequestInput();
    builder.appendBuilderParameters(adRequestInput);
    BidRequest actualBidRequest = adRequestInput.getBidRequest();
    assertNull(actualBidRequest.getRegs().coppa);
}
Also used : AdSize(org.prebid.mobile.rendering.bidding.data.AdSize) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) BasicParameterBuilder(org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder) BidRequest(org.prebid.mobile.rendering.models.openrtb.BidRequest) Test(org.junit.Test)

Example 23 with AdSize

use of org.prebid.mobile.rendering.bidding.data.AdSize in project prebid-mobile-android by prebid.

the class BannerView method reflectAttrs.

// endregion ==================== getters and setters
private void reflectAttrs(AttributeSet attrs) {
    if (attrs == null) {
        LogUtil.debug(TAG, "reflectAttrs. No attributes provided.");
        return;
    }
    TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.BannerView, 0, 0);
    try {
        mConfigId = typedArray.getString(R.styleable.BannerView_configId);
        mRefreshIntervalSec = typedArray.getInt(R.styleable.BannerView_refreshIntervalSec, 0);
        int width = typedArray.getInt(R.styleable.BannerView_adWidth, -1);
        int height = typedArray.getInt(R.styleable.BannerView_adHeight, -1);
        if (width >= 0 && height >= 0) {
            mAdUnitConfig.addSize(new AdSize(width, height));
        }
    } finally {
        typedArray.recycle();
    }
}
Also used : TypedArray(android.content.res.TypedArray) AdSize(org.prebid.mobile.rendering.bidding.data.AdSize)

Example 24 with AdSize

use of org.prebid.mobile.rendering.bidding.data.AdSize in project prebid-mobile-android by prebid.

the class DeviceInfoParameterBuilder method appendBuilderParameters.

@Override
public void appendBuilderParameters(AdRequestInput adRequestInput) {
    DeviceInfoManager deviceManager = ManagersResolver.getInstance().getDeviceManager();
    if (deviceManager != null) {
        int screenWidth = deviceManager.getScreenWidth();
        int screenHeight = deviceManager.getScreenHeight();
        Device device = adRequestInput.getBidRequest().getDevice();
        device.pxratio = Utils.DENSITY;
        if (screenWidth > 0 && screenHeight > 0) {
            device.w = screenWidth;
            device.h = screenHeight;
        }
        String advertisingId = AdIdManager.getAdId();
        if (Utils.isNotBlank(advertisingId)) {
            device.ifa = advertisingId;
        }
        device.make = Build.MANUFACTURER;
        device.model = Build.MODEL;
        device.os = PLATFORM_VALUE;
        device.osv = Build.VERSION.RELEASE;
        device.language = Locale.getDefault().getLanguage();
        device.ua = AppInfoManager.getUserAgent();
        // lmt and APP_ADVERTISING_ID_ENABLED are opposites
        boolean lmt = AdIdManager.isLimitAdTrackingEnabled();
        device.lmt = lmt ? 1 : 0;
        final AdSize minSizePercentage = mAdConfiguration.getMinSizePercentage();
        if (minSizePercentage != null) {
            device.getExt().put("prebid", Prebid.getJsonObjectForDeviceMinSizePerc(minSizePercentage));
        }
    }
}
Also used : Device(org.prebid.mobile.rendering.models.openrtb.bidRequests.Device) AdSize(org.prebid.mobile.rendering.bidding.data.AdSize) DeviceInfoManager(org.prebid.mobile.rendering.sdk.deviceData.managers.DeviceInfoManager)

Example 25 with AdSize

use of org.prebid.mobile.rendering.bidding.data.AdSize in project prebid-mobile-android by prebid.

the class BasicParameterBuilder method setVideoImpValues.

private void setVideoImpValues(Imp imp) {
    Video video = new Video();
    // Common values for all video reqs
    video.mimes = SUPPORTED_VIDEO_MIME_TYPES;
    video.protocols = SUPPORTED_VIDEO_PROTOCOLS;
    video.linearity = VIDEO_LINEARITY_LINEAR;
    // Interstitial video specific values
    // On Leaving Viewport or when Terminated by User
    video.playbackend = VIDEO_INTERSTITIAL_PLAYBACK_END;
    video.delivery = new int[] { VIDEO_DELIVERY_DOWNLOAD };
    if (mAdConfiguration.isAdPositionValid()) {
        video.pos = mAdConfiguration.getAdPositionValue();
    }
    if (!mAdConfiguration.isPlacementTypeValid()) {
        video.placement = PlacementType.INTERSTITIAL.getValue();
        if (mResources != null) {
            Configuration deviceConfiguration = mResources.getConfiguration();
            video.w = deviceConfiguration.screenWidthDp;
            video.h = deviceConfiguration.screenHeightDp;
        }
    } else {
        video.placement = mAdConfiguration.getPlacementTypeValue();
        for (AdSize size : mAdConfiguration.getAdSizes()) {
            video.w = size.width;
            video.h = size.height;
            break;
        }
    }
    imp.video = video;
}
Also used : Configuration(android.content.res.Configuration) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) Video(org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Video) AdSize(org.prebid.mobile.rendering.bidding.data.AdSize)

Aggregations

AdSize (org.prebid.mobile.rendering.bidding.data.AdSize)25 Test (org.junit.Test)15 AdConfiguration (org.prebid.mobile.rendering.models.AdConfiguration)15 BasicParameterBuilder (org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder)9 Imp (org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp)6 Configuration (android.content.res.Configuration)4 BidRequest (org.prebid.mobile.rendering.models.openrtb.BidRequest)4 Banner (org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Banner)2 Video (org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Video)2 SuppressLint (android.annotation.SuppressLint)1 Context (android.content.Context)1 TypedArray (android.content.res.TypedArray)1 HashSet (java.util.HashSet)1 JSONArray (org.json.JSONArray)1 Before (org.junit.Before)1 MockMediationUtils (org.prebid.mobile.rendering.bidding.config.MockMediationUtils)1 Device (org.prebid.mobile.rendering.models.openrtb.bidRequests.Device)1 Ext (org.prebid.mobile.rendering.models.openrtb.bidRequests.Ext)1 User (org.prebid.mobile.rendering.models.openrtb.bidRequests.User)1 DeviceInfoManager (org.prebid.mobile.rendering.sdk.deviceData.managers.DeviceInfoManager)1