本文整理汇总了Java中com.applovin.sdk.AppLovinAdSize类的典型用法代码示例。如果您正苦于以下问题:Java AppLovinAdSize类的具体用法?Java AppLovinAdSize怎么用?Java AppLovinAdSize使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AppLovinAdSize类属于com.applovin.sdk包,在下文中一共展示了AppLovinAdSize类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: appLovinAdSizeFromAdMobAdSize
import com.applovin.sdk.AppLovinAdSize; //导入依赖的package包/类
private AppLovinAdSize appLovinAdSizeFromAdMobAdSize(final AdSize adSize) {
if (AdSize.BANNER.equals(adSize)) {
return AppLovinAdSize.BANNER;
} else if (AdSize.MEDIUM_RECTANGLE.equals(adSize)) {
return AppLovinAdSize.MREC;
} else if (AdSize.LEADERBOARD.equals(adSize)) {
return AppLovinAdSize.LEADER;
}
return null;
}
示例2: loadNextAd
import com.applovin.sdk.AppLovinAdSize; //导入依赖的package包/类
private static synchronized void loadNextAd() {
if (sLoadList.size() > 0 && ((sCurrentlyLoading != null
&& sCurrentlyLoading != sLoadList.get(0)) || sCurrentlyLoading == null)) {
sCurrentlyLoading = sLoadList.get(0);
log(DEBUG, "Loading next interstitial ad from load list");
sInterstitialSdk.getAdService().loadNextAd(
AppLovinAdSize.INTERSTITIAL, sLoadList.get(0));
} else if (sLoadList.size() == 0) {
log(DEBUG, "No more interstitials to load");
} else {
log(DEBUG, "Another ad is currently loading");
}
}
示例3: appLovinAdSizeFromAdMobAdSize
import com.applovin.sdk.AppLovinAdSize; //导入依赖的package包/类
private AppLovinAdSize appLovinAdSizeFromAdMobAdSize(final AdSize adSize)
{
final boolean isSmartBanner = ( adSize.getWidth() == AdSize.FULL_WIDTH ) && ( adSize.getHeight() == AdSize.AUTO_HEIGHT );
if ( AdSize.BANNER.equals( adSize ) || AdSize.LARGE_BANNER.equals( adSize ) || isSmartBanner )
{
return AppLovinAdSize.BANNER;
}
else if ( AdSize.MEDIUM_RECTANGLE.equals( adSize ) )
{
return AppLovinAdSize.MREC;
}
else if ( AdSize.LEADERBOARD.equals( adSize ) )
{
return AppLovinAdSize.LEADER;
}
// This is not a one of AdMob's predefined size
else
{
// Assume fluid width, and check for height with offset tolerance
final int offset = Math.abs( BANNER_STANDARD_HEIGHT - adSize.getHeight() );
if ( offset <= BANNER_HEIGHT_OFFSET_TOLERANCE )
{
return AppLovinAdSize.BANNER;
}
}
return null;
}
示例4: appLovinAdSizeFromLocalExtras
import com.applovin.sdk.AppLovinAdSize; //导入依赖的package包/类
private AppLovinAdSize appLovinAdSizeFromLocalExtras(final Map<String, Object> localExtras)
{
// Handle trivial case
if ( localExtras == null || localExtras.isEmpty() )
{
log( ERROR, "No serverExtras provided" );
return null;
}
try
{
final int width = (Integer) localExtras.get( AD_WIDTH_KEY );
final int height = (Integer) localExtras.get( AD_HEIGHT_KEY );
// We have valid dimensions
if ( width > 0 && height > 0 )
{
log( DEBUG, "Valid width (" + width + ") and height (" + height + ") provided" );
// Assume fluid width, and check for height with offset tolerance
final int offset = Math.abs( BANNER_STANDARD_HEIGHT - height );
if ( offset <= BANNER_HEIGHT_OFFSET_TOLERANCE )
{
return AppLovinAdSize.BANNER;
}
else if ( height <= AppLovinAdSize.MREC.getHeight() )
{
return AppLovinAdSize.MREC;
}
else
{
log( ERROR, "Provided dimensions does not meet the dimensions required of banner or mrec ads" );
}
}
else
{
log( ERROR, "Invalid width (" + width + ") and height (" + height + ") provided" );
}
}
catch ( Throwable th )
{
log( ERROR, "Encountered error while parsing width and height from serverExtras", th );
}
return null;
}
示例5: loadInterstitial
import com.applovin.sdk.AppLovinAdSize; //导入依赖的package包/类
@Override
public void loadInterstitial(final Context context, final CustomEventInterstitialListener listener, final Map<String, Object> localExtras, final Map<String, String> serverExtras)
{
log( DEBUG, "Requesting AppLovin interstitial with localExtras: " + localExtras );
// SDK versions BELOW 7.2.0 require a instance of an Activity to be passed in as the context
if ( AppLovinSdk.VERSION_CODE < 720 && !( context instanceof Activity ) )
{
log( ERROR, "Unable to request AppLovin banner. Invalid context provided." );
listener.onInterstitialFailed( MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR );
return;
}
// Store parent objects
this.listener = listener;
this.context = context;
final AppLovinSdk sdk = AppLovinSdk.getInstance( context );
sdk.setPluginVersion( "MoPub-2.1.0" );
// Zones support is available on AppLovin SDK 7.5.0 and higher
final String serverExtrasZoneId = serverExtras != null ? serverExtras.get( "zone_id" ) : null;
zoneId = ( !TextUtils.isEmpty( serverExtrasZoneId ) && AppLovinSdk.VERSION_CODE >= 750 ) ? serverExtrasZoneId : DEFAULT_ZONE;
// Check if we already have a preloaded ad for the given zone
final AppLovinAd preloadedAd = dequeueAd( zoneId );
if ( preloadedAd != null )
{
log( DEBUG, "Found preloaded ad for zone: {" + zoneId + "}" );
adReceived( preloadedAd );
}
else
{
// If this is a default Zone, create the incentivized ad normally
if ( DEFAULT_ZONE.equals( zoneId ) )
{
sdk.getAdService().loadNextAd( AppLovinAdSize.INTERSTITIAL, this );
}
// Otherwise, use the Zones API
else
{
// Dynamically load an ad for a given zone without breaking backwards compatibility for publishers on older SDKs
try
{
final Method method = sdk.getAdService().getClass().getMethod( "loadNextAdForZoneId", String.class, AppLovinAdLoadListener.class );
method.invoke( sdk.getAdService(), zoneId, this );
}
catch ( Throwable th )
{
log( ERROR, "Unable to load ad for zone: " + zoneId + "..." );
listener.onInterstitialFailed( MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR );
}
}
}
}
示例6: requestInterstitialAd
import com.applovin.sdk.AppLovinAdSize; //导入依赖的package包/类
@Override
public void requestInterstitialAd(final Context context, final CustomEventInterstitialListener listener, final String serverParameter, final MediationAdRequest mediationAdRequest, final Bundle customEventExtras)
{
log( DEBUG, "Requesting AppLovin interstitial..." );
// SDK versions BELOW 7.2.0 require a instance of an Activity to be passed in as the context
if ( AppLovinSdk.VERSION_CODE < 720 && !( context instanceof Activity ) )
{
log( ERROR, "Unable to request AppLovin interstitial. Invalid context provided." );
listener.onAdFailedToLoad( AdRequest.ERROR_CODE_INVALID_REQUEST );
return;
}
// Store parent objects
this.listener = listener;
this.context = context;
final AppLovinSdk sdk = AppLovinSdk.getInstance( context );
sdk.setPluginVersion( "AdMob-2.0" );
// Zones support is available on AppLovin SDK 7.5.0 and higher
if ( AppLovinSdk.VERSION_CODE >= 750 && customEventExtras != null && customEventExtras.containsKey( "zone_id" ) )
{
zoneId = customEventExtras.getString( "zone_id" );
}
else
{
zoneId = DEFAULT_ZONE;
}
// Check if we already have a preloaded ad for the given zone
final AppLovinAd preloadedAd = dequeueAd( zoneId );
if ( preloadedAd != null )
{
log( DEBUG, "Found preloaded ad for zone: {" + zoneId + "}" );
adReceived( preloadedAd );
}
else
{
// If this is a default Zone, load the interstitial ad normally
if ( DEFAULT_ZONE.equals( zoneId ) )
{
sdk.getAdService().loadNextAd( AppLovinAdSize.INTERSTITIAL, this );
}
// Otherwise, use the Zones API
else
{
// Dynamically load an ad for a given zone without breaking backwards compatibility for publishers on older SDKs
try
{
final Method method = sdk.getAdService().getClass().getMethod( "loadNextAdForZoneId", String.class, AppLovinAdLoadListener.class );
method.invoke( sdk.getAdService(), zoneId, this );
}
catch ( Throwable th )
{
log( ERROR, "Unable to load ad for zone: " + zoneId + "..." );
listener.onAdFailedToLoad( AdRequest.ERROR_CODE_INVALID_REQUEST );
}
}
}
}