I add all codes of admob into my project and when I test it by admob test code , it work well . but
if i try to add my own appID and UnitID , my Ads don't shows
//
I think before publishing App it doesnt show
am I right or I have some other problem ?
java.class
layout.xml
Manifest.xml
I don't think that I have code problem
I think it is because of that my app in not published
please answer me thank you.
This will surely shows the advertisement even without publishing app. Make sure you also sign in to google adsense with the same account you signed in to admob.
Make Sure your payment account is setup with admob.
Also for testing purpose, you need to add your device as text device.
Like This
smartAd = (AdView) findViewById(R.id.smartAd);
adRequest = new AdRequest.Builder().addTestDevice("709D9B***********629841A46A05C6B").build();
smartAd.loadAd(adRequest);
You can find your device number in logs.
Hope this will help.
Related
Ad-mob test ads is not showing on one of my app ,but the same code is working fine on my others app,
then I find out that this is happening because of the app package name ,if I rename the package name then also ads are showing.
Some months ago the app were showing ads , but app got ads serving limited issue ,then I deleted all the ad units from Admob of the app ,after one week this issue solved ,then I wanted to implement ads again but since then even test ads are not showing.
and I couldn't found an error on logcat so I don't Know what to do
There are two things here.
Either you show test ads via local configuration before initializing the sdk like -
val testDeviceIds = Arrays.asList("Your Test ID from logcat. ")
val configuration = RequestConfiguration.Builder().setTestDeviceIds(testDeviceIds).build()
MobileAds.setRequestConfiguration(configuration)
Or add the following in your app-ads.txt file.
google.com, pub-3940256099942544, DIRECT, f08c47fec0942fa0.
More info here: https://developers.google.com/admob/android/test-ads
Admob does not deliver ad when your app live any time. Add test id's and change your application id then test your implementation. When you live your application then restore your application id in gradle and live your app. When your app live on play store admob deliver your ad.
I just finished my first app, and plan to earn money by admob ads. When I monetise a new app on admob, it want me to search my app in app markets. Does it mean that I should publish my app before put ads in it?
If so, what should I do after getting the admob ad unit id? Copy it into my code and republish a new version of my app which contains the real ads (not the test one)? It sounds stupid to build and publish a new version of app only to put some ads in it.
You should create the Ad Units on AdMob, and then, you only add the next line when you do the requests in your code:
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("XXXXX")
Where "XXXXX" is a the code associated to that specific device, that you obtain in the Logcat. You can add as many devices as you want to test. It is not necessary to remove the lines when compiling or when releasing for Google Play.
You should compile your first release with the ad code ready to go. (That's what I always do).
You use the test script so that you get dummy ads, that their clients don't get charged for, when you're testing. Then you simply swap out that line for the REAL ad serving code when you're ready to release.
You're not going to get in any trouble if you test with the actual admob code as long as you dont:
1. Click an ad. Ever.
2. Test it a gazillion times. Use the test ad for that.
I am working with adding Google ads in android apps...
my code is as follows
adView = new AdView(this, AdSize.SMART_BANNER, "xxxxxxxxxx");
LinearLayout layout = (LinearLayout)findViewById(R.id.mainlayout);
layout.addView(adView);
AdRequest ads=new AdRequest();
ads.addTestDevice(AdRequest.TEST_EMULATOR);
adView.loadAd(ads);
all is working fine on emulator but doesn't show ads on my device
please suggest me what i'm doing wrong here
Using AdRequest.addTestDevice(TEST_EMULATOR) is the way to fetch the add during testing. However, this piece of code will only fetch test ads from emulators. Everyone running your app on a device will get live ads, and you'll get revenue when users click on those live ads.
Even if you used AdRequest.addTestDevice("YOUR_DEVICE_ID") to get test ads on your device, this only requests test ads on that one specific device, and every other device will get live ads. You don't have to worry about your users getting test ads once you release.
To get DEVICE_ID check this.
This is said by Eric Leichtenschlag Developer Programs Engineer for Google, specializing in Google AdMob Ads SDK support.
You need to check this.
I am using Admob SDK to load banner ads from DFP on Android.
I am using the XML method as defined in this page to load up the ads: https://developers.google.com/mobile-ads-sdk/docs/dfp/fundamentals
When I run the apps, I get
06-21 16:44:30.354: I/Ads(2641): onFailedToReceiveAd(Invalid Ad request.)
When I change to testing mode by
adRequest.addTestDevice("xxx");
Then I can see the Google Test banner successfully. So assume my SDK integration is correct, what the heck if the "Invalid Ad request"?
Your ad unit is most likely invalid. You need to get access to the DFP account you are using and make sure that the network ID, ad unit name and dimensions are correct. There could be no matching ads or anything could be going on really... but like you say the test ad works so it is most probably something setup wrong within DFP.
I usually work with DFP on websites so things may be slightly different with the Admob SDK but if it is any help I have this little tool I use to test my DFP ad delivery:
http://coop182.github.io/jquery.dfp.js/dfptests/test.html?google_console=1&networkID=15572793&adunitID=Leader&dimensions=728x90
you can also press CTRL+F10 to bring up the DFP web console and get some more information on the delivery of the ad... but like I said this might not be that much help because it is an Admob ad... but worth a shot!
Form another thread here :
You don't need to have an app already on the market to get a Publisher ID for a new app. In the Android Package URL field that's on the "Add Site/App" form, just enter "market://details?id=your.package.name". You'll of course want to replace the 'your.package.name' with your app's actual package name.
The viewWidth warnings are fine and you will likely still see them after inserting your Publisher ID.
EDIT: There's a nice suggestion here too.
All- I recently published an app on Google Play. I was wondering if it is possible to add ads in an update of my app, or if my app has to start with ads? (Much like you can't go from free to $0.99 for example). Thanks for your time.
This is azgolfers answer/comment but I just wanted to put in answer fromat to help other users know that my question has indeed been answered: "You can always add ads to your published apps. Ads network has nothing to do with Google Play store. Hopefully your published app is free, otherwise your users will complain if you put ads in your paid apps."
No its not possible to add new ads to your application without update your application and without this trick :D
i am also a developer and publisher.
day before yesterday admob disable my ads 1 of my favorite app.
i didn't remember my .jks file password which mean now i can't update my app.
i try to find a solution but didn't get anything.
but today while i m study about firebase real time database i get an idea which may also helps you.
Here is a Plan :-
1st :- don't store your ad ids on string.xml because you can't update string
2nd :- integrate ads only with code ( without layout )
3rd :- now where you put your ads id
mAdView.setAdUnitId("ca-app-pub-8023878856256738/1741045606");
instead to put "ca-app-pub... your ad id " pass variable which connect to firebase database and then place your ads id on firebase db
benefit of this trick :-
if you want to add new ads just create new ads id and then just change in firebase db
in app ads will automatically switch to your new ads :)
firebase realtime db video