FB 广告错误代码:-1 未知错误 - Android Interstitial
FB Ads Error Code: -1 Unknown error - Android Interstitial
我以前展示过 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();
有同样的问题。我建议你下载 Facebook 最新版本的库并重新导入它。希望能解决
新的 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();
}
我以前展示过 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();
有同样的问题。我建议你下载 Facebook 最新版本的库并重新导入它。希望能解决
新的 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();
}