本文整理汇总了Java中com.facebook.ads.InterstitialAd类的典型用法代码示例。如果您正苦于以下问题:Java InterstitialAd类的具体用法?Java InterstitialAd怎么用?Java InterstitialAd使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InterstitialAd类属于com.facebook.ads包,在下文中一共展示了InterstitialAd类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: request
import com.facebook.ads.InterstitialAd; //导入依赖的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);
mInterstitialAd = new InterstitialAd(mContext, placementId);
mInterstitialAd.setAdListener(this);
mInterstitialAd.loadAd();
}
}
}
示例2: requestInterstitialAd
import com.facebook.ads.InterstitialAd; //导入依赖的package包/类
@Override
public void requestInterstitialAd(Context context,
MediationInterstitialListener listener,
Bundle serverParameters,
MediationAdRequest adRequest,
Bundle mediationExtras) {
mInterstitialListener = listener;
if (!isValidRequestParameters(context, serverParameters)) {
mInterstitialListener.onAdFailedToLoad(this, AdRequest.ERROR_CODE_INVALID_REQUEST);
return;
}
String placementId = serverParameters.getString(PLACEMENT_PARAMETER);
mInterstitialAd = new InterstitialAd(context, placementId);
mInterstitialAd.setAdListener(new InterstitialListener());
buildAdRequest(adRequest);
mInterstitialAd.loadAd();
}
示例3: showAd
import com.facebook.ads.InterstitialAd; //导入依赖的package包/类
@ReactMethod
public void showAd(String placementId, Promise p) {
if (mPromise != null) {
p.reject("E_FAILED_TO_SHOW", "Only one `showAd` can be called at once");
return;
}
ReactApplicationContext reactContext = this.getReactApplicationContext();
mPromise = p;
mInterstitial = new InterstitialAd(reactContext, placementId);
mInterstitial.setAdListener(this);
mInterstitial.loadAd();
}
示例4: requestAd
import com.facebook.ads.InterstitialAd; //导入依赖的package包/类
@Override
public void requestAd(MediatedInterstitialAdViewController mIC, Activity activity, String parameter, String uid, TargetingParameters tp) {
FacebookListener fbListener = new FacebookListener(mIC, this.getClass().getSimpleName());
interstitialAd = new InterstitialAd(activity, uid);
interstitialAd.setAdListener(fbListener);
interstitialAd.loadAd();
}