marcojak / MauiMTAdmob

MIT License
104 stars 17 forks source link

Advertisement not visible - MAUI Android app #74

Closed ekontro closed 2 months ago

ekontro commented 2 months ago

Hi, I created a test application adding the required entries:

In the MainActivity.cs file: protected override void OnCreate(Bundle? savedInstanceState) { base.OnCreate(savedInstanceState); MobileAds.Initialize(this); }

In the MainPage.xaml file: xmlns:controls="clr-namespace:Plugin.MauiMTAdmob.Controls;assembly=Plugin.MauiMTAdmob"

and

In the AndroidManifest.xaml file:
marcojak commented 2 months ago

Hi.

You don't need to initialise the mobile ads, but you need to initialise the plugin in the platform code.

You can check the sample code to see how to initialise it.

On Mon, 15 Apr 2024, 20:45 ekontro, @.***> wrote:

Hi, I created a test application adding the required entries:

In the MainActivity.cs file: protected override void OnCreate(Bundle? savedInstanceState) { base.OnCreate(savedInstanceState); MobileAds.Initialize(this); }

In the MainPage.xaml file:

xmlns:controls="clr-namespace:Plugin.MauiMTAdmob.Controls;assembly=Plugin.MauiMTAdmob"

and

<controls:MTAdView x:Name="AdView" AdsId="ca-app-pub-3940256099942544/9214589741" HeightRequest="50" WidthRequest="320" Grid.Row="0" IsVisible="True">

In the AndroidManifest.xaml file: <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-170763......./>

The application starts, but the banner is not visible. What could be the reasons for this?

— Reply to this email directly, view it on GitHub https://github.com/marcojak/MauiMTAdmob/issues/74, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUIPITSR2CRWY3675TLMXLY5QN55AVCNFSM6AAAAABGH4RQF2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGI2DIMZXGQ3TINI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ekontro commented 2 months ago

Thank you Marco, In fact, it was enough to change the initialization code. Now the test ads are visible for e.g. adsID "ca-app-pub-3940256099942544/9214589741", but when changing to the real banner ID the ad is still not visible. Is it because the application is not approved or connected to the store?

marcojak commented 2 months ago

I'm glad it worked.

Correct. Your app needs to be on the store to view the ads. It's also forbidden to show real ads during tests and Google might suspend or cancel your account doing this. This is why you should always use test ads Ids or insert your device id as test device. Anyway if the test ads work, then the normal ads will work as well.

On Mon, 15 Apr 2024, 23:02 ekontro, @.***> wrote:

Thank you Marco, In fact, it was enough to change the initialization code. Now the test ads are visible for e.g. adsID "ca-app-pub-3940256099942544/9214589741", but when changing to the real banner ID the ad is still not visible. Is it because the application is not approved or connected to the store?

— Reply to this email directly, view it on GitHub https://github.com/marcojak/MauiMTAdmob/issues/74#issuecomment-2057800839, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUIPIRQZA6KNCWN77CDZM3Y5Q57FAVCNFSM6AAAAABGH4RQF2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJXHAYDAOBTHE . You are receiving this because you commented.Message ID: @.***>

ekontro commented 2 months ago

Thank you very much Marco for your help :)