Closed JeroenMBooij closed 1 year ago
You can add a banner programmatically.
Create the banner view in you c# code and attach it to a container like a stacklayout or a grid or anything you like.
On Sun, 24 Jul 2022, 16:36 Jeroen, @.***> wrote:
I got the interstitial to work inside a Maui Blazor application. However my banner ad is displaying a black bar. Is there anyway to display the banner ad without using XAML? How do you attach the MTAdView to your layout if you are using HTML?
— Reply to this email directly, view it on GitHub https://github.com/marcojak/MauiMTAdmob/issues/4, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUIPIUSVHG5XFHD5XJB2RTVVVPGZANCNFSM54P2XTHA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
@marcojak Is this also possible with an HTML element?
I could add the banner to MainPage.xaml using XAML, but I want to be able to position the banner underneath my navigation bar
`<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:Routine" xmlns:admob="clr-namespace:Plugin.MauiMTAdmob.Controls;assembly=Plugin.MauiMTAdmob" x:Class="Routine.MainPage" BackgroundColor="{DynamicResource PageBackgroundColor}">
<StackLayout>
<admob:MTAdView></admob:MTAdView>
<BlazorWebView HostPage="wwwroot/index.html">
<BlazorWebView.RootComponents>
<RootComponent Selector="#app" ComponentType="{x:Type local:Main}" />
</BlazorWebView.RootComponents>
</BlazorWebView>
</StackLayout>
`
I've done a quick search and apparently Admob can only be used in an Android and iOS app using the official SDK (no support for web), so it's not possible in Blazor. Adsense is not allowed in an app.
If you don't want to show the ads over the navigation bar, an option is to use a Grid and then build your website considering the position of the AdView.
@marcojak That should work too. Thanks for the tip!
I got the interstitial to work inside a Maui Blazor application. However my banner ad is displaying a black bar. Is there anyway to display the banner ad without using XAML? How do you attach the MTAdView to your layout if you are using HTML?