本文整理汇总了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();
}
}
}
示例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();
}
}
}
示例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();
}
示例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.
}
示例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.
}
示例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);
}
示例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();
}
示例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();
}