Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Adding ads to Android project

$
0
0

Hi, I'm following this guide by the one and only Mr. Montemagno and I'm having trouble with some parts of it.
I added permissions but when I try to integrate the AdView the guide says "Simply open the layout file where the ad will live". I only have Toolbar and Tabbar under Layouts and I'm not even using them, I set the 'layout' like this:

this.SetContentView(application.AndroidContentView);

What Layout does my program use? Do I need to create a layout and set it in SetContentView? All my game is working on Application.AndroidContentView so if I change it, it probably won't show it. (I know, too many questions, I'm kind of lost :D )

What I did was add the code in the guide to my Toolbar layout but the compiler says:

    ads:adSize="SMART_BANNER" // <- attribute not declared
    ads:adUnitId="@string/banner_ad_unit_id" /> // <- attribute not declared

Also on this line:
var adView = FindViewById<AdView>(Resource.Id.adView);
it says: 'Resource.Id' does not contain a definition of AdView even though it is set on the Toolbar layout like this:
android:id="@+id/adView"
Any ideas on what's going on?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>