FB Ads Error Code: -1 Unknown error - Android Interstitial
I've run Facebook ads before but today the Interstitial ads stopped working, we tried debug mode. I am getting an error with code -1 and the name Unknown error.
I am using the following code:
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();
+3
source to share
2 answers
New Facebook SDK: Try this one time
// 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();
}
+1
source to share