When registering an app in Google AdMob, the following must be set.
1. Add app
Add an app registered in the Play Store
2. Register the developer site of the registered appAdd app
Register the app's website on the play console
3. Register APP-ADS.TXT on the website
The app should be visible in the APP-ADS.TXT tab
If you do not see the app connected to the APP-ADS.TXT tab of the AdMob site even after doing this, try the following.
MobileAds.Initialize
How to attach AdMob ads to Xamarin.Forms apps is well known on the Internet, but most of them are wrong.
It is said to be put in Oncreate of MainActivity.cs as follows.
protected override void OnCreate(Bundle savedInstanceState)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(savedInstanceState);
MobileAds.Initialize(ApplicationContext, "//APPLICATION_ID//");
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
LoadApplication(new App());
}
MobileAds.Initialize(ApplicationContext, "//APPLICATION_ID//");
It is said that this part is no longer used.
Application ID is registered in AndroidManifest.xml, so you can just use it as follows.
MobileAds.Initialize(this);
Let's distribute by modifying as above.



Comments
Post a Comment