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