marcojak / MauiMTAdmob

MIT License
104 stars 17 forks source link

How do I get the CrossMauiMTAdmob.Current.AdsId variable in my MainPage.xaml? #51

Open rdemboski opened 6 months ago

rdemboski commented 6 months ago

My app.xaml.cs file contains this:

using Plugin.MauiMTAdmob;

namespace MauiApp2 { public partial class App : Application { public App() { InitializeComponent();

        // Set the Ad Unit ID based on the platform
        CrossMauiMTAdmob.Current.AdsId =
        DeviceInfo.Platform == DevicePlatform.Android
        ? "ca-app-pub-3940256099942544/8214777181"
        : "ca-app-pub-3940256099942544/4255350878";

        MainPage = new AppShell();
    }
}

}

how can I use the value of CrossMauiMTAdmob.Current.AdsId in my MainPage.xaml?