之前我已经展示了Facebook广告,但今天插页式广告停止了工作,我们尝试了调试模式,我收到错误代码为-1并命名为未知错误。
我正在使用以下代码:
fbInterstitialAd =new com.facebook.ads.InterstitialAd(mContext,id_facebook);
fbInterstitialAd.setAdListener(new InterstitialAdListener() {
@Override
public void onInterstitialDisplayed(Ad ad) {
}
@Override
public void onInterstitialDismissed(Ad ad) {
adDismissed.run();
}
@Override
public void onError(Ad ad, AdError adError) {
Log.d("FBads",adError.getErrorMessage());
}
@Override
public void onAdLoaded(Ad ad) {
adLoaded.run();
}
@Override
public void onAdClicked(Ad ad) {
adClickedCallback.run();
}
});
fbInterstitialAd.loadAd();
答案 0 :(得分:1)
有同样的问题。我建议你下载Facebook最新版本库并重新导入它。希望能解决它
答案 1 :(得分:1)
新的Facebook SDK代码:尝试一次
// Declare the InterstitialActivity in AndroidManifest.xml:
// <activity android:name="com.facebook.ads.InterstitialAdActivity"
// android:configChanges="keyboardHidden|orientation" />
// In the Activity that will launch the interstitial,
// implement the AdListener interface and add the following:
import com.facebook.ads.*;
private InterstitialAd interstitialAd;
private void loadInterstitialAd() {
interstitialAd = new InterstitialAd(this, "id_facebook");
interstitialAd.setAdListener(this);
interstitialAd.loadAd();
}
@Override
public void onError(Ad ad, AdError error) {
// Ad failed to load
}
@Override
public void onAdLoaded(Ad ad) {
// Ad is loaded and ready to be displayed
// You can now display the full screen add using this code:
interstitialAd.show();
}