facebook ad cant' load in sdk version 5.+ - android

i have create facebook ad demo app, but can't load any ad(Interstitial ,Native ,Banner) in any version sdk.
if i using sdk version 5.3.0 then facebook ad return error.
Error: New bundles must use latest available Audience Network SDK.
if i using sdk version 5.5.0,5.6.0 then facebook ad return error.
Error: No fill
i also tried live ad id(264476213973610_264482430639655) and testing ad id (YOUR_PLACEMENT_ID) but doesn't work
AudienceNetworkAds.initialize(this);
final InterstitialAd interstitialAd = new InterstitialAd(MainActivity.this, "YOUR_PLACEMENT_ID");
AdSettings.addTestDevice("6f2e675e-05b0-46d8-b3d6-032ef6a25fdb");
interstitialAd.destroy();
interstitialAd.setAdListener(new InterstitialAdListener() {
#Override
public void onInterstitialDisplayed(Ad ad) {
Log.e(TAG, "Interstitial ad displayed.");
}
#Override
public void onInterstitialDismissed(Ad ad) {
Log.e(TAG, "Interstitial ad dismissed.");
}
#Override
public void onError(Ad ad, AdError adError) {
Toast.makeText(MainActivity.this, "Error: " + adError.getErrorMessage(), Toast.LENGTH_LONG).show();
}
#Override
public void onAdLoaded(Ad ad) {
Toast.makeText(MainActivity.this, "Loaded: " + ad.getPlacementId(), Toast.LENGTH_LONG).show();
interstitialAd.show();
}
#Override
public void onAdClicked(Ad ad) {
Log.d(TAG, "Interstitial ad clicked!");
}
#Override
public void onLoggingImpression(Ad ad) {
Log.d(TAG, "Interstitial ad impression logged!");
}
});
interstitialAd.loadAd();

I had faced a similar issue. So I'll explain how I solved it.
To test properly on your device, you need to follow some other steps too other than you mentioned in the question.
STEPS:
Properly follow the interstitial, banner, etc. documentation to integrate ads
Download the official Facebook app (which is required to get test ads) and log in using either tester's account or Admin's account of the Audience Network. FB doesn't return ads if it doesn't find its official app on the device because it crawls the data of the account to provide the relevant ads to the user
Add test device to get test ads (or live ads for testing which doesn't give you revenue). To add a device:
i) Login to your Audience Network account
ii) Go to Monetization Manager > Integration > Testing
iii) Add test device using Android's AAID or iOS's IDFA. You can check other SO's threads to find AAID or IDFA of the device, in case you don't know.
iv) You can test it in the device now and you must be getting ads. If still there are no ads, select Use real advertiser content option there itself. Now to test different type of ads like HD Video, Simple Image or such; Click Select Ad Type on the same screen
NOTE: Remember to check the article on FAN's ad Caching in Android 9+ because HD Video or any type of video ads won't show on Android 9+ and you might get a blank screen blocking all the functionalities of your app.

use sdk version com.facebook.android:audience-network-sdk:5.11.0

Related

how to use the physical device to test ads [Android]

After the change of the version of google services ads, the addTestDevice option no longer appears, how can I see bonus videos on a physical device?
AdRequest adRequest = new AdRequest.Builder().build();
RewardedAd.load(this, "ca-app-pub-3940256099942544/5224354917",
adRequest, new RewardedAdLoadCallback() {
#Override
public void onAdFailedToLoad(#NonNull LoadAdError loadAdError) {
// Handle the error.
// Log.d(TAG, loadAdError.getMessage());
mRewardedAd = null;
}
#Override
public void onAdLoaded(#NonNull RewardedAd rewardedAd) {
mRewardedAd = rewardedAd;
//Log.d(TAG, "Ad was loaded.");
}
});
You can follow steps here
Add a test device To make changes to a test device, such as enabling
or changing ad inspector gestures, you’ll need to remove the test
device and set it up again. Sign in to your AdMob account at
https://apps.admob.com.
Click Settings in the sidebar.
Click the Test devices tab.
Click Add test device.
Select the platform of your device.
Enter a device name. Consider using a name that will help you quickly
identify your devices in your AdMob account.
Note: The device name will be visible to anyone who has access to your
AdMob account.
Enter your Advertising ID/IDFA. Learn how to find your advertising
ID/IDFA.
Select a gesture to use to activate ad inspector:
None. If you select none, you can still activate ad inspector with an
API call. Learn more.
Shake
Flick twice
Click Done.

Unity reward Ad not ready to be shown on android 9

I try to show Unity Ads rewarded placement through mediation on Android device, i figured out that its working on android 8 but when i test it on android 9 then UnityAds.isReady() always returns false.
this is the latest mediation gradle configuration.
implementation 'com.google.ads.mediation:unity:3.4.6.0'
this is my configuration code
//UnityAds.initialize(AdTask.this, AdConfig.UNITY_AD_GAME_ID, unityAdsListener,true);//this approach is depecated
UnityAds.initialize(AdTask.this,AdConfig.UNITY_AD_GAME_ID,true);
UnityAds.isInitialized(); // just to making sure that its been initialized
UnityAdsImplementation.addListener(unityAdsListener);
this is how i try to show the ad
if (UnityAds.isReady(AdConfig.UNITY_AD_NEW_TASK_PLACEMENT_ID)) {
UnityAds.show(AdTask.this, AdConfig.UNITY_AD_NEW_TASK_PLACEMENT_ID);
}
and this is my listener class
private class UnityAdsListener implements IUnityAdsListener {
#Override
public void onUnityAdsReady (String placementId) {
// Implement functionality for an ad being ready to show.
}
#Override
public void onUnityAdsStart (String placementId) {
// Implement functionality for a user starting to watch an ad.
}
#Override
public void onUnityAdsFinish (String placementId, UnityAds.FinishState finishState) {
// Implement functionality for a user finishing an ad.
Log.d("unityad","finished");
}
#Override
public void onUnityAdsError (UnityAds.UnityAdsError error, String message) {
// Implement functionality for a Unity Ads service error occurring.
Log.d("ERROR","zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"+message);
}
}
i debugged each steps and found that unity ad gets initialized but ad is not ready to be shown.
log has no clue what is happening therefore i am not sharing the logcat. if any of you have experienced this before then i would love to know how you handled this.
I don't know if it's related, But I'm currently working on my game and ads were working fine, today (like 1 hour ago) i tested my game and the ads were not ready no matter what.. perhaps it's a problem with Google ads?

Admob Not showing ads on real devices only showing on Test devices only

private void showInterstitialadd() {
mInterstitialAd = new InterstitialAd(MainActivity.this);
// set the ad unit ID
mInterstitialAd.setAdUnitId(getString(R.string.interstitial_full_screen));
AdRequest adRequest = new AdRequest.Builder()
.build();
// Load ads into Interstitial Ads
mInterstitialAd.loadAd(adRequest);
mInterstitialAd.setAdListener(new AdListener() {
public void onAdLoaded() {
showInterstitial();
}
});
}
private void showInterstitial() {
if (mInterstitialAd.isLoaded()) {
mInterstitialAd.show();
}
}
I am using the above function for showing Ads....and its working absolutely fine on my test device but when I remove that .addTestdevice().....and run on any other devices it does not shows up....
There may be no issue in your code but AdMob doesn't show ads on real device quickly. You have to wait for few days. Before that, you have to enter some details like address and payment account detail in your AdMob account.
Don't worry they guide via email.
After you enter details, wait for few days, you will be notified in AdMob account that ads are showing.
In my case, it takes 2 days and, only Banner and Interstitial ads were activated at that time and video ads still do not get loaded.
So if ads are showing on test device then it will also be showing in the real device. The only thing you have to do is complete AdMob account setup and wait.
Also, don't forget to remove .addTestdevice() code before checking on real device.

Admob Reward Video Ads don't work with test devices

We want to integrate Reward Video Ads in our app (https://firebase.google.com/docs/admob/android/rewarded-video).
The ads work great if we don't provide the test device. However, if we do, we receive error code 0 aka ERROR_CODE_INTERNAL_ERROR, so the execution goes through onRewardedVideoAdFailedToLoad.
Is this something somebody else has encountered?
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_ad);
MobileAds.initialize(this, APP_ID);
mAd = MobileAds.getRewardedVideoAdInstance(this);
mAd.setRewardedVideoAdListener(this);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice("C67A1A9F2F19699874B7718074819FF9") // Test devices don't work work with rewarded video ads.
.build();
mAd.loadAd(AD_UNIT_ID, adRequest);
}
#Override
public void onRewardedVideoAdFailedToLoad(int errorCode) {
Toast.makeText(this, "onRewardedVideoAdFailedToLoad", Toast.LENGTH_SHORT).show();
}
I revisited this in November 2017 and the test device flag DOES now work with rewarded video Ads.
You can't use test devices for rewarded video, from this forum post:
"For Reward Videos, the following are our test Ad Unit ID:
iOS - ca-app-pub-3940256099942544/1712485313
Android - ca-app-pub-3940256099942544/5224354917
Note that Reward Video Ad Unit IDs are platform specific"

android InMobi + adMob?

I want to show InMobi ad in my app. When InMobi ad is not showing (InMobi not success) I want to show adMob ad. How can I check that InMobi is success. Also is showing ad.
I know that Madvertise has a Callbacklistener.
madView = (MadvertiseView) findViewById(R.id.layoutMadView);
madView.setMadvertiseViewCallbackListener(new MadvertiseViewCallbackListener() {
#Override
public void onLoaded(boolean success, MadvertiseView arg1) {
if (success) {
// Madvertise ad
} else {
// adMob ad
}
}}
I tried to change this to InMobi, but its not working.
What do you mean by MAdvertise ? I don't see any official documentation either for this class.
If you want to show ads from multiple providers, you can use Ad Network Mediation. It also allows you to set preference order of advertisers.

Categories

Resources