当前位置: 首页>>代码示例>>Java>>正文


Java NativeAd.setAdListener方法代码示例

本文整理汇总了Java中com.facebook.ads.NativeAd.setAdListener方法的典型用法代码示例。如果您正苦于以下问题:Java NativeAd.setAdListener方法的具体用法?Java NativeAd.setAdListener怎么用?Java NativeAd.setAdListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.facebook.ads.NativeAd的用法示例。


在下文中一共展示了NativeAd.setAdListener方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: request

import com.facebook.ads.NativeAd; //导入方法依赖的package包/类
@Override
protected void request(Context context, Map<String, String> networkData) {
    if (context == null || networkData == null) {
        invokeLoadFail(PNException.ADAPTER_MISSING_DATA);
    } else {
        mContext = context;
        String placementId = networkData.get(Facebook.KEY_PLACEMENT_ID);
        if (TextUtils.isEmpty(placementId)) {
            invokeLoadFail(PNException.ADAPTER_ILLEGAL_ARGUMENTS);
        } else {
            mAdView = null;
            mWrapper = null;

            Facebook.init(context);
            mNativeAd = new NativeAd(context, placementId);
            mNativeAd.setAdListener(this);
            mNativeAd.loadAd();
        }
    }
}
 
开发者ID:pubnative,项目名称:pubnative-android-sdk,代码行数:21,代码来源:FacebookNetworkAdapter.java

示例2: request

import com.facebook.ads.NativeAd; //导入方法依赖的package包/类
@Override
protected void request(Context context, Map<String, String> networkData) {
    if (context == null || networkData == null) {
        invokeLoadFail(PNException.ADAPTER_MISSING_DATA);
    } else {
        mContext = context;
        String placementId = networkData.get(Facebook.KEY_PLACEMENT_ID);
        if (TextUtils.isEmpty(placementId)) {
            invokeLoadFail(PNException.ADAPTER_ILLEGAL_ARGUMENTS);
        } else {
            Facebook.init(context);
            mAdView = null;
            mWrapper = null;
            mNativeAd = new NativeAd(context, placementId);
            mNativeAd.setAdListener(this);
            mNativeAd.loadAd();
        }
    }
}
 
开发者ID:pubnative,项目名称:pubnative-android-sdk,代码行数:20,代码来源:FacebookNetworkAdapter.java

示例3: requestNativeAd

import com.facebook.ads.NativeAd; //导入方法依赖的package包/类
@Override
public void requestNativeAd(Context context,
                            MediationNativeListener listener,
                            Bundle serverParameters,
                            NativeMediationAdRequest mediationAdRequest,
                            Bundle mediationExtras) {
    mNativeListener = listener;
    if (!isValidRequestParameters(context, serverParameters)) {
        mNativeListener.onAdFailedToLoad(this, AdRequest.ERROR_CODE_INVALID_REQUEST);
        return;
    }

    // Verify that the request is for both app install and content ads.
    if (!(mediationAdRequest.isAppInstallAdRequested()
            && mediationAdRequest.isContentAdRequested())) {
        Log.w(TAG, "Failed to request native ad. Both app install and content ad should be "
                + "requested");
        mNativeListener.onAdFailedToLoad(this, AdRequest.ERROR_CODE_INVALID_REQUEST);
        return;
    }

    String placementId = serverParameters.getString(PLACEMENT_PARAMETER);

    // Get the optional extras if set by the publisher.
    if (mediationExtras != null) {
        mIsAdChoicesIconExpandable = mediationExtras.getBoolean(
                FacebookExtrasBundleBuilder.KEY_EXPANDABLE_ICON, true);
    }

    mMediaView = new MediaView(context);

    mNativeAd = new NativeAd(context, placementId);
    mNativeAd.setAdListener(new NativeListener(mNativeAd, mediationAdRequest));
    buildAdRequest(mediationAdRequest);
    mNativeAd.loadAd();
}
 
开发者ID:googleads,项目名称:googleads-mobile-android-mediation,代码行数:37,代码来源:FacebookAdapter.java

示例4: onAdsLoaded

import com.facebook.ads.NativeAd; //导入方法依赖的package包/类
@Override
public void onAdsLoaded() {

    //This method will download ad from FB
    //& call addNativeAd method which will add ad to listview

    NativeAd ad = this.listNativeAdsManager.nextNativeAd();
    ad.setAdListener(this);
    if (itemAdapter!=null)
        itemAdapter.addNativeAd(ad);   //postitemadaptere tanımlıyoruz.
}
 
开发者ID:aknkaplanoglu,项目名称:Sportmix,代码行数:12,代码来源:FotomacFragment.java

示例5: onAdsLoaded

import com.facebook.ads.NativeAd; //导入方法依赖的package包/类
@Override
public void onAdsLoaded() {

    //This method will download ad from FB
    //& call addNativeAd method which will add ad to listview

    NativeAd ad = this.listNativeAdsManager.nextNativeAd();
    ad.setAdListener(this);
    if (itemAdapter!=null)
    itemAdapter.addNativeAd(ad);   //postitemadaptere tanımlıyoruz.
}
 
开发者ID:aknkaplanoglu,项目名称:Sportmix,代码行数:12,代码来源:SporxFragment.java

示例6: onCreate

import com.facebook.ads.NativeAd; //导入方法依赖的package包/类
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    listNativeAd = new NativeAd(this, "YOUR_PLACEMENT_ID");
    listNativeAd.setAdListener(this);
    listNativeAd.loadAd();

    listView = getListView();
    adapter = new ListViewAdapter(getApplicationContext());
    listView.setAdapter(adapter);
}
 
开发者ID:benbek,项目名称:HereAStory-Android,代码行数:12,代码来源:NativeAdListActivity.java

示例7: createRequest

import com.facebook.ads.NativeAd; //导入方法依赖的package包/类
protected void createRequest(Context context, String placementId) {
    Facebook.init(context);
    mNativeAd = new NativeAd(context, placementId);
    mNativeAd.setAdListener(this);
    mNativeAd.loadAd();
}
 
开发者ID:pubnative,项目名称:pubnative-android-sdk,代码行数:7,代码来源:FacebookNetworkAdapter.java

示例8: requestNativeAd

import com.facebook.ads.NativeAd; //导入方法依赖的package包/类
/**
 * AppNexus SDk calls this method to request a native ad from Facebook
 *
 * @param context The context from which this class is instantiated.
 * @param uid Facebook placement id, app developer needs to set up account with Facebook.
 * @param mBC The controller that passes callbacks to AppNexus SDK
 * @param tp Targeting parameters that were set in AppNexus API.
 * @return AppNexus NativeAdResponse that wraps Facebook ad.
 */

@Override
public void requestNativeAd(Context context, String uid, final MediatedNativeAdController mBC, TargetingParameters tp) {
    NativeAd nativeAd = new NativeAd(context, uid);
    FBNativeAdResponse response = new FBNativeAdResponse(nativeAd);
    nativeAd.setAdListener(new FacebookNativeAdListener(mBC, response));
    nativeAd.loadAd();
}
 
开发者ID:appnexus,项目名称:mobile-sdk-android,代码行数:18,代码来源:FacebookNativeAd.java


注:本文中的com.facebook.ads.NativeAd.setAdListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。