Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display google ads in Android using XML only?

I want to place a google ad in my project. But for some reason, I don't want to use Java language for this purpose. I have already tried the ads:loadAdOnCreate="true" attribute, but I think it is not working now. Is there any idea by which I can display ads by using XML only?

like image 223
Nabin Bhandari Avatar asked Feb 08 '23 16:02

Nabin Bhandari


2 Answers

You should use old library of google ads , so that loadAdOnCreate will be available.

like image 171
Roshan Sharma Avatar answered Feb 14 '23 00:02

Roshan Sharma


loadAdOnCreate is no longer available in new SDK, you need to write java code to display your ads.

For ads integration you can check Harshad's answer

From official Doc by Amy Quispe (AdMob SDK Team)

loadAdOnCreate was deprecated in the Google Play Services version, so you'll have to load the ad from the code.

like image 43
Ravi Avatar answered Feb 13 '23 23:02

Ravi