Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Banner Ads space on screen not automatically hiding/removing when ad doesn't show/load in .Net MAUI Blazor iOS #70

Open
bangaras opened this issue Mar 8, 2024 · 0 comments

Comments

@bangaras
Copy link

bangaras commented Mar 8, 2024

I am working on .Net MAUI Blazor iOS, I have added bottom space for showing banner ads, but when ads doesn't show/load then my bottom space still present.
In Android it automatically handles when ad doesn't load. Same code I have in .Net Blazor iOS.
Please give me any suggestion how can I remove when ads doesn't load.

//MainPage.cs code

public partial class MainPage : ContentPage
{
    Grid grid;
	public MainPage()
	{
		InitializeComponent();
        if (DeviceInfo.Current.Platform == DevicePlatform.Android || DeviceInfo.Current.Platform == DevicePlatform.iOS)
        {
            grid = new Grid()
            {
                RowDefinitions =
                {
                    new RowDefinition { Height = new GridLength(1, GridUnitType.Star) },
                    new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }
                }
            }
        }
        else
        {
            grid = new Grid()
            {
                RowDefinitions =
                {
                    new RowDefinition { Height = new GridLength(1, GridUnitType.Star) },
                    new RowDefinition { Height = new GridLength(0) }
                }
            };
        }
        BlazorWebView blazorWebView = new BlazorWebView() { HostPage = "wwwroot/index.html" };
        blazorWebView.RootComponents.Add(new RootComponent() { Selector = "#app", ComponentType = typeof(Main) });
        grid.Add(blazorWebView, 0, 0);
        MTAdView myAds = new MTAdView();
        if (DeviceInfo.Current.Platform == DevicePlatform.Android || DeviceInfo.Current.Platform == DevicePlatform.iOS)
        {
            grid.Add(myAds, 0, 1);
        }
        contentpg.Content = grid;
#if __ANDROID__
        myAds.AdsId = "xyz";
#elif __IOS__
		myAds.AdsId = "xyz";
#endif
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant