本文整理汇总了Java中com.mopub.nativeads.NativeErrorCode类的典型用法代码示例。如果您正苦于以下问题:Java NativeErrorCode类的具体用法?Java NativeErrorCode怎么用?Java NativeErrorCode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NativeErrorCode类属于com.mopub.nativeads包,在下文中一共展示了NativeErrorCode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onError
import com.mopub.nativeads.NativeErrorCode; //导入依赖的package包/类
@Override
public void onError(final Ad ad, final AdError adError) {
if (adError == null) {
this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.UNSPECIFIED);
} else {
switch (adError.getErrorCode()) {
case AdError.NO_FILL_ERROR_CODE:
this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.NETWORK_NO_FILL);
break;
case AdError.NETWORK_ERROR_CODE:
this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.CONNECTION_ERROR);
break;
case AdError.SERVER_ERROR_CODE:
this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.SERVER_ERROR_RESPONSE_CODE);
break;
default:
this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.UNEXPECTED_RESPONSE_CODE);
break;
}
}
}
开发者ID:ayltai,项目名称:mopub-nativead-adapters,代码行数:25,代码来源:FacebookNativeAd.java
示例2: loadNativeAd
import com.mopub.nativeads.NativeErrorCode; //导入依赖的package包/类
@Override
public void loadNativeAd(@NonNull final Context context, @NonNull final CustomEventNative.CustomEventNativeListener customEventNativeListener, @NonNull final Map<String, Object> localExtras, @NonNull final Map<String, String> serverExtras) {
final String apiKey = serverExtras.get(BaseEventNative.KEY_API_KEY);
if (this.validateApiKey(apiKey)) {
this.init(context, apiKey);
final FlurryNativeAd nativeAd = this.createNativeAd(context, customEventNativeListener, apiKey, null);
this.onLoadNativeAd(nativeAd);
nativeAd.fetchAd();
} else {
customEventNativeListener.onNativeAdFailed(NativeErrorCode.NATIVE_ADAPTER_CONFIGURATION_ERROR);
}
}
开发者ID:ayltai,项目名称:mopub-nativead-adapters,代码行数:17,代码来源:FlurryEventNative.java
示例3: onError
import com.mopub.nativeads.NativeErrorCode; //导入依赖的package包/类
@Override
public void onError(final FlurryAdNative nativeAd, final FlurryAdErrorType adErrorType, final int errorCode) {
switch (adErrorType) {
case FETCH:
this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.NETWORK_NO_FILL);
break;
case CLICK:
this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.NATIVE_ADAPTER_CONFIGURATION_ERROR);
break;
case RENDER:
this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.NATIVE_RENDERER_CONFIGURATION_ERROR);
break;
default:
this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.UNSPECIFIED);
break;
}
}
开发者ID:ayltai,项目名称:mopub-nativead-adapters,代码行数:21,代码来源:FlurryNativeAd.java
示例4: onAdFailedToLoad
import com.mopub.nativeads.NativeErrorCode; //导入依赖的package包/类
protected void onAdFailedToLoad(final int errorCode) {
switch (errorCode) {
case AdRequest.ERROR_CODE_NO_FILL:
AdMobNativeAd.this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.NETWORK_NO_FILL);
break;
case AdRequest.ERROR_CODE_NETWORK_ERROR:
AdMobNativeAd.this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.CONNECTION_ERROR);
break;
case AdRequest.ERROR_CODE_INVALID_REQUEST:
AdMobNativeAd.this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.INVALID_REQUEST_URL);
break;
case AdRequest.ERROR_CODE_INTERNAL_ERROR:
AdMobNativeAd.this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.SERVER_ERROR_RESPONSE_CODE);
break;
default:
AdMobNativeAd.this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.UNEXPECTED_RESPONSE_CODE);
break;
}
}
开发者ID:ayltai,项目名称:mopub-nativead-adapters,代码行数:24,代码来源:AdMobNativeAd.java
示例5: onError
import com.mopub.nativeads.NativeErrorCode; //导入依赖的package包/类
@Override
public void onError(ErrorMessage errorMessage) {
Log.w(TAG, "onError : " + errorMessage);
switch (errorMessage) {
case GENERIC:
mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.UNSPECIFIED);
break;
case NOADS:
mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.NETWORK_NO_FILL);
break;
case RESOURCES_DOWNLOAD_FAIL:
mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.NETWORK_INVALID_STATE);
break;
case NOTVISIBLE:
mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.NETWORK_NO_FILL);
break;
default:
mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.NETWORK_INVALID_STATE);
}
}
开发者ID:VMFive,项目名称:android-sdk-3.0,代码行数:21,代码来源:VM5NativeStatic.java
示例6: loadNativeAd
import com.mopub.nativeads.NativeErrorCode; //导入依赖的package包/类
@Override
public void loadNativeAd(@NonNull final Context context, @NonNull final CustomEventNative.CustomEventNativeListener customEventNativeListener, @NonNull final Map<String, Object> localExtras, @NonNull final Map<String, String> serverExtras) {
final String apiKey = serverExtras.get(BaseEventNative.KEY_API_KEY);
if (this.validateApiKey(apiKey)) {
final AppLovinNativeAd nativeAd = this.createNativeAd(context, customEventNativeListener, apiKey, null);
this.onLoadNativeAd(nativeAd);
nativeAd.fetchAd();
} else {
customEventNativeListener.onNativeAdFailed(NativeErrorCode.NATIVE_ADAPTER_CONFIGURATION_ERROR);
}
}
开发者ID:ayltai,项目名称:mopub-nativead-adapters,代码行数:15,代码来源:AppLovinEventNative.java
示例7: loadNativeAd
import com.mopub.nativeads.NativeErrorCode; //导入依赖的package包/类
@Override
public void loadNativeAd(@NonNull final Context context, @NonNull final CustomEventNative.CustomEventNativeListener customEventNativeListener, @NonNull final Map<String, Object> localExtras, @NonNull final Map<String, String> serverExtras) {
final String adUnitId = serverExtras.get(BaseEventNative.KEY_AD_UNIT_ID);
if (this.validateAdUnitId(adUnitId)) {
final FacebookNativeAd nativeAd = this.createNativeAd(context, customEventNativeListener, null, adUnitId);
this.onLoadNativeAd(nativeAd);
nativeAd.fetchAd();
} else {
customEventNativeListener.onNativeAdFailed(NativeErrorCode.NATIVE_ADAPTER_CONFIGURATION_ERROR);
}
}
开发者ID:ayltai,项目名称:mopub-nativead-adapters,代码行数:15,代码来源:FacebookEventNative.java
示例8: onAdLoaded
import com.mopub.nativeads.NativeErrorCode; //导入依赖的package包/类
@Override
public void onAdLoaded(final Ad ad) {
// This identity check is from Facebook's Native API sample code:
// https://developers.facebook.com/docs/audience-network/android/native-api
if (!this.nativeAd.equals(ad) || !this.nativeAd.isAdLoaded()) {
this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.NETWORK_INVALID_STATE);
return;
}
this.setTitle(this.nativeAd.getAdTitle());
this.setText(this.nativeAd.getAdBody());
final NativeAd.Image coverImage = this.nativeAd.getAdCoverImage();
if (coverImage != null) this.setMainImageUrl(coverImage.getUrl());
final NativeAd.Image icon = this.nativeAd.getAdIcon();
if (icon != null) this.setIconImageUrl(icon.getUrl());
this.setCallToAction(this.nativeAd.getAdCallToAction());
this.setStarRating(FacebookNativeAd.getStarRatingValue(this.nativeAd.getAdStarRating()));
this.addExtra(FacebookNativeAd.SOCIAL_CONTEXT_FOR_AD, this.nativeAd.getAdSocialContext());
final NativeAd.Image adChoicesIconImage = this.nativeAd.getAdChoicesIcon();
if (adChoicesIconImage != null) {
this.setPrivacyInformationIconImageUrl(adChoicesIconImage.getUrl());
this.setPrivacyInformationIconClickThroughUrl(this.nativeAd.getAdChoicesLinkUrl());
}
this.preCacheImages(this.getImageUrls());
this.setImpressionMinTimeViewed(BaseStaticNativeAd.IMPRESSION_MIN_TIME);
}
开发者ID:ayltai,项目名称:mopub-nativead-adapters,代码行数:34,代码来源:FacebookNativeAd.java
示例9: loadNativeAd
import com.mopub.nativeads.NativeErrorCode; //导入依赖的package包/类
@Override
public void loadNativeAd(@NonNull final Context context, @NonNull final CustomEventNative.CustomEventNativeListener customEventNativeListener, @NonNull final Map<String, Object> localExtras, @NonNull final Map<String, String> serverExtras) {
final String adUnitId = serverExtras.get(BaseEventNative.KEY_AD_UNIT_ID);
if (this.validateAdUnitId(adUnitId)) {
final T nativeAd = this.createNativeAd(context, customEventNativeListener, null, adUnitId);
this.onLoadNativeAd(nativeAd);
nativeAd.fetchAd();
} else {
customEventNativeListener.onNativeAdFailed(NativeErrorCode.NATIVE_ADAPTER_CONFIGURATION_ERROR);
}
}
开发者ID:ayltai,项目名称:mopub-nativead-adapters,代码行数:15,代码来源:AdMobEventNative.java
示例10: onNativeAdsFailedToLoad
import com.mopub.nativeads.NativeErrorCode; //导入依赖的package包/类
@Override
public void onNativeAdsFailedToLoad(final int errorCode) {
switch (errorCode) {
case AppLovinErrorCodes.FETCH_AD_TIMEOUT:
case AppLovinErrorCodes.INCENTIVIZED_SERVER_TIMEOUT:
this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.NETWORK_TIMEOUT);
break;
case AppLovinErrorCodes.NO_NETWORK:
this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.CONNECTION_ERROR);
break;
case AppLovinErrorCodes.INCENTIVIZED_UNKNOWN_SERVER_ERROR:
this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.SERVER_ERROR_RESPONSE_CODE);
break;
case AppLovinErrorCodes.INVALID_URL:
this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.INVALID_REQUEST_URL);
break;
case AppLovinErrorCodes.NO_FILL:
this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.NETWORK_NO_FILL);
break;
default:
this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.UNSPECIFIED);
break;
}
}
开发者ID:ayltai,项目名称:mopub-nativead-adapters,代码行数:30,代码来源:AppLovinNativeAd.java
示例11: fetchAd
import com.mopub.nativeads.NativeErrorCode; //导入依赖的package包/类
public void fetchAd(final Context context) {
MoPubNative moPubNative = new MoPubNative(context, BuildConfig.MOPUB_NATIVE_AD_UNIT_ID,
new MoPubNative.MoPubNativeNetworkListener() {
@Override public void onNativeLoad(NativeAd nativeAd) {
View view = nativeAd.createAdView(context, null);
nativeAd.clear(view);
nativeAd.renderAdView(view);
nativeAd.prepare(view);
ad.call(new AdResponse(view, AdResponse.Status.ok));
}
@Override public void onNativeFail(NativeErrorCode nativeErrorCode) {
ad.call(new AdResponse(null, AdResponse.Status.error));
}
});
ViewBinder viewBinder =
new ViewBinder.Builder(R.layout.mopub_native_ad).mainImageId(R.id.timeline_ad_image)
.iconImageId(R.id.card_image)
.titleId(R.id.card_title)
.textId(R.id.timeline_ad_description)
.callToActionId(R.id.timeline_ad_button)
.build();
MoPubStaticNativeAdRenderer adRenderer = new MoPubStaticNativeAdRenderer(viewBinder);
moPubNative.registerAdRenderer(adRenderer);
moPubNative.makeRequest(new RequestParameters.Builder().desiredAssets(
EnumSet.of(RequestParameters.NativeAdAsset.TITLE, RequestParameters.NativeAdAsset.TEXT,
RequestParameters.NativeAdAsset.MAIN_IMAGE, RequestParameters.NativeAdAsset.ICON_IMAGE,
RequestParameters.NativeAdAsset.CALL_TO_ACTION_TEXT))
.build());
}
开发者ID:Aptoide,项目名称:aptoide-client-v8,代码行数:32,代码来源:TimelineAdsRepository.java
示例12: onAdRequestSuccess
import com.mopub.nativeads.NativeErrorCode; //导入依赖的package包/类
/**
* Method to be implemented when the adRequest is successful.
*
* @param ads a list of NativeAdUnit objects
*/
@Override
public void onAdRequestSuccess(List<NativeAd> ads) {
if(ads == null || ads.size() <= 0) {
customEventNativeListener.onNativeAdFailed(NativeErrorCode.EMPTY_AD_RESPONSE);
return;
}
NativeAd ad = ads.get(0);
PMMoPubNativeAdAdapter mopubAd = new PMMoPubNativeAdAdapter(ad, context, customEventNativeListener);
}
开发者ID:Pocketbrain,项目名称:androidnativeadslib,代码行数:17,代码来源:PMMoPubNativeCustomEvent.java
示例13: onNativeAdsLoaded
import com.mopub.nativeads.NativeErrorCode; //导入依赖的package包/类
@Override
public void onNativeAdsLoaded(final List nativeAds)
{
final AppLovinNativeAd nativeAd = (AppLovinNativeAd) nativeAds.get( 0 );
log( DEBUG, "Native ad did load ad: " + nativeAd.getAdId() );
final List<String> imageUrls = new ArrayList<>( 2 );
if ( nativeAd.getIconUrl() != null ) imageUrls.add( nativeAd.getIconUrl() );
if ( nativeAd.getImageUrl() != null ) imageUrls.add( nativeAd.getImageUrl() );
// Please note: If/when we add support for videos, we must use AppLovin SDK's built-in precaching mechanism
runOnUiThread( new Runnable()
{
@Override
public void run()
{
NativeImageHelper.preCacheImages( context, imageUrls, new NativeImageHelper.ImageListener()
{
@Override
public void onImagesCached()
{
handleNativeAdFinishedCaching( nativeAd );
}
@Override
public void onImagesFailedToCache(NativeErrorCode nativeErrorCode)
{
handleNativeAdFinishedCaching( nativeAd );
}
} );
}
} );
}
开发者ID:AppLovin,项目名称:SDK-Network-Adaptors,代码行数:37,代码来源:AppLovinCustomEventNative.java
示例14: toMoPubErrorCode
import com.mopub.nativeads.NativeErrorCode; //导入依赖的package包/类
private static NativeErrorCode toMoPubErrorCode(final int applovinErrorCode)
{
if ( applovinErrorCode == AppLovinErrorCodes.NO_FILL )
{
return NativeErrorCode.NETWORK_NO_FILL;
}
else if ( applovinErrorCode == AppLovinErrorCodes.UNSPECIFIED_ERROR )
{
return NativeErrorCode.NETWORK_INVALID_STATE;
}
else if ( applovinErrorCode == AppLovinErrorCodes.NO_NETWORK )
{
return NativeErrorCode.CONNECTION_ERROR;
}
else if ( applovinErrorCode == AppLovinErrorCodes.FETCH_AD_TIMEOUT )
{
return NativeErrorCode.NETWORK_TIMEOUT;
}
else if ( applovinErrorCode == AppLovinErrorCodes.UNABLE_TO_PREPARE_NATIVE_AD )
{
return NativeErrorCode.INVALID_RESPONSE;
}
else
{
return NativeErrorCode.UNSPECIFIED;
}
}
开发者ID:AppLovin,项目名称:SDK-Network-Adaptors,代码行数:28,代码来源:AppLovinCustomEventNative.java
示例15: onNativeFail
import com.mopub.nativeads.NativeErrorCode; //导入依赖的package包/类
@Override
public void onNativeFail(final NativeErrorCode errorCode) {
Log.w(this.getClass().getSimpleName(), errorCode.toString());
}
开发者ID:ayltai,项目名称:mopub-nativead-adapters,代码行数:5,代码来源:MainActivity.java
示例16: onImagesFailedToCache
import com.mopub.nativeads.NativeErrorCode; //导入依赖的package包/类
@Override
public void onImagesFailedToCache(final NativeErrorCode errorCode) {
BaseStaticNativeAd.this.customEventNativeListener.onNativeAdFailed(errorCode);
}
开发者ID:ayltai,项目名称:mopub-nativead-adapters,代码行数:5,代码来源:BaseStaticNativeAd.java
示例17: loadNativeAd
import com.mopub.nativeads.NativeErrorCode; //导入依赖的package包/类
@Override
protected void loadNativeAd(@NonNull Activity activity,
@NonNull CustomEventNativeListener customEventNativeListener,
@NonNull Map<String, Object> localExtras,
@NonNull Map<String, String> serverExtras) {
Log.d(TAG, "Request native Ad");
String apiKey = "";
if (serverExtras.containsKey("apiKey")) {
apiKey = serverExtras.get("apiKey");
} else {
Log.e(TAG, "User should specify apiKey in serverExtras");
customEventNativeListener.onNativeAdFailed(NativeErrorCode.NATIVE_ADAPTER_CONFIGURATION_ERROR);
return;
}
String placementName = "";
if (serverExtras.containsKey("placement")) {
placementName = serverExtras.get("placement");
} else {
Log.e(TAG, "User should specify placement in serverExtras");
customEventNativeListener.onNativeAdFailed(NativeErrorCode.NATIVE_ADAPTER_CONFIGURATION_ERROR);
return;
}
boolean isTestMode = true;
if (serverExtras.containsKey("test")) {
isTestMode = serverExtras.get("test").equals("1");
} else {
Log.e(TAG, "User should specify test in serverExtras");
customEventNativeListener.onNativeAdFailed(NativeErrorCode.NATIVE_ADAPTER_CONFIGURATION_ERROR);
return;
}
mVM5StaticNativeAd = new VM5StaticNativeAd(activity,
new ImpressionTracker(activity),
new NativeClickHandler(activity),
customEventNativeListener);
AdDelegator adDelegator = new AdDelegator(activity, apiKey, placementName, AdViewType.BANNER_VIDEO);
adDelegator.setTestMode(isTestMode);
adDelegator.setAdListener(mVM5StaticNativeAd);
mVM5StaticNativeAd.setAdDelegator(adDelegator);
adDelegator.loadAd();
}
开发者ID:VMFive,项目名称:android-sdk-3.0,代码行数:45,代码来源:VM5NativeStatic.java
示例18: onAdLoaded
import com.mopub.nativeads.NativeErrorCode; //导入依赖的package包/类
@Override
public void onAdLoaded(AdObject adObject) {
Log.d(TAG, "Native ad loaded successfully.");
if (mAdDelegator == null) {
mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.NETWORK_INVALID_STATE);
return;
}
if (adObject.getAdTitle() != null && !adObject.getAdTitle().equals("")) {
setTitle(adObject.getAdTitle());
} else {
setTitle("title");
}
if (adObject.getAdDescription() != null && !adObject.getAdDescription().equals("")) {
setText(adObject.getAdDescription());
} else {
setText("description");
}
if (adObject.getImageUrl() != null) {
setMainImageUrl(adObject.getImageUrl());
}
if (adObject.getIconUrl() != null) {
setIconImageUrl(adObject.getIconUrl());
}
setClickDestinationUrl(adObject.getAdTrigger().getActionUrl());
if (adObject.getAdCtaText() != null && !adObject.getAdCtaText().equals("")) {
setCallToAction(adObject.getAdCtaText());
} else {
setCallToAction("More");
}
setStarRating(1.0);
setImpressionMinTimeViewed(IMPRESSION_MIN_TIME_VIEWED);
final List<String> imageUrls = new ArrayList<String>();
final String mainImageUrl = getMainImageUrl();
if (mainImageUrl != null) {
imageUrls.add(mainImageUrl);
}
final String iconUrl = getIconImageUrl();
if (iconUrl != null) {
imageUrls.add(iconUrl);
}
preCacheImages(mContext, imageUrls, new NativeImageHelper.ImageListener() {
@Override
public void onImagesCached() {
mCustomEventNativeListener.onNativeAdLoaded(VM5StaticNativeAd.this);
}
@Override
public void onImagesFailedToCache(NativeErrorCode errorCode) {
mCustomEventNativeListener.onNativeAdFailed(errorCode);
}
});
onDestroy();
}
开发者ID:VMFive,项目名称:android-sdk-3.0,代码行数:63,代码来源:VM5NativeStatic.java
示例19: PMMoPubNativeAdAdapter
import com.mopub.nativeads.NativeErrorCode; //导入依赖的package包/类
public PMMoPubNativeAdAdapter(@NonNull NativeAd ad, final Context context, final CustomEventNative.CustomEventNativeListener customEventNativeListener) {
this.customEventNativeListener = customEventNativeListener;
this.ad = ad;
this.context = context;
NativeAdImages images = ad.getImages();
setIconImageUrl(ad.getCampaignImage());
if(images.getBanner() != null) {
setMainImageUrl(images.getBanner().getUrl());
}
setTitle(ad.getCampaignName());
setCallToAction(ad.getActionText());
setText(ad.getCampaignDescription());
setClickDestinationUrl(ad.getClickURL());
// setPrivacyInformationIconClickThroughUrl(ad.getRedirectionUrl());
// setPrivacyInformationIconImageUrl(ad.getIconUrl());
final List<String> imageUrls = new ArrayList<String>();
final String mainImageUrl = getMainImageUrl();
if (mainImageUrl != null) {
imageUrls.add(getMainImageUrl());
}
final String iconUrl = getIconImageUrl();
if (iconUrl != null) {
imageUrls.add(getIconImageUrl());
}
NativeImageHelper.preCacheImages(context, imageUrls, new NativeImageHelper.ImageListener() {
@Override
public void onImagesCached() {
customEventNativeListener.onNativeAdLoaded(PMMoPubNativeAdAdapter.this);
}
@Override
public void onImagesFailedToCache(NativeErrorCode errorCode) {
customEventNativeListener.onNativeAdFailed(errorCode);
}
});
}
开发者ID:Pocketbrain,项目名称:androidnativeadslib,代码行数:45,代码来源:PMMoPubNativeAdAdapter.java
示例20: onAdFailed
import com.mopub.nativeads.NativeErrorCode; //导入依赖的package包/类
@Override
public void onAdFailed(String message) {
mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.SERVER_ERROR_RESPONSE_CODE);
}
开发者ID:picatcha,项目名称:adsnative-sdk-android,代码行数:5,代码来源:PolymorphNativeAdNetwork.java
注:本文中的com.mopub.nativeads.NativeErrorCode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论