I have a MAUI Blazor Hybrid mobile application and I want to add Admob ads. I found a way to do so in XAML: https://www.mauiexpert.it/admob-for-maui-made-easy/
but I would like to wrap such functionality into Blazor component so it is easily reusable across my Blazor pages.
Yes, theoretically I can use Google AdSense but from what I read AdMob gives better PPC than AdSense.
Is there a way how to achieve this ?
After some research I came to this conclusion.
Option #1
Google allows showing Ads in WebView just for one specific usecase and its when you have a website which contains Adsense ads and you just want to show that website inside your app in WebView control.
Src: https://developers.google.com/ad-manager/mobile-ads-sdk/android/webview
For that specific case you would register your webview. Install Nuget package:
Xamarin.GooglePlayServices.Ads
and insideMainPage.xaml.cs
put:after that you put
meta-data
tag mentioned in the google doc toAndroidManifest.xml
<application>
tag like:But as I mentioned already we cant use it just for embedding HTML of adsense ad and wrapping it into simple component.
Option #2
Option #3
There is probably no other way how to achieve wrapping ad into Blazor component in Blazor Hybrid bacause you cant embed XAML into blazor and thats why the only way how to show google ad in your MAUI Blazor app is by using admob library: Plugin.MauiMTAdmob
With this we can create XAML ad and we can place it under or over our
BlazorWebView
component so it can overlap a part of it.