user14837396
user14837396

Reputation:

How to integrate Google Admob into .NET 6 android app?

Now with .NET 6, we can create native android apps without Xamarin. I would like to know if there's a way to monetize these MAUI apps with Google Admob.

Upvotes: 2

Views: 1683

Answers (4)

Equalisys
Equalisys

Reputation: 25

you can try to use the NuGet package Plugin.MauiMTAdmob avaliable here : NuGet Gallery - Plugin.MauiMTAdmob

Upvotes: 0

user18763174
user18763174

Reputation: 81

It seems not working on .Net 6

package mono.com.google.android.ump;


public class ConsentForm_OnConsentFormDismissedListenerImplementor
    extends java.lang.Object
    implements
        mono.android.IGCUserPeer,
        com.google.android.ump.ConsentForm.OnConsentFormDismissedListener
{
/** @hide */
    public static final String __md_methods;
    static {
        __md_methods = 
            "n_onConsentFormDismissed:(Lcom/google/android/ump/FormError;)V:GetOnConsentFormDismissed_Lcom_google_android_ump_FormError_Handler:Xamarin.Google.UserMesssagingPlatform.IConsentFormOnConsentFormDismissedListenerInvoker, Xamarin.Google.UserMessagingPlatform\n" +
            "";
        mono.android.Runtime.register ("Xamarin.Google.UserMesssagingPlatform.IConsentFormOnConsentFormDismissedListenerImplementor, Xamarin.Google.UserMessagingPlatform", ConsentForm_OnConsentFormDismissedListenerImplementor.class, __md_methods);
    }


    public ConsentForm_OnConsentFormDismissedListenerImplementor ()
    {
        super ();
        if (getClass () == ConsentForm_OnConsentFormDismissedListenerImplementor.class)
            mono.android.TypeManager.Activate ("Xamarin.Google.UserMesssagingPlatform.IConsentFormOnConsentFormDismissedListenerImplementor, Xamarin.Google.UserMessagingPlatform", "", this, new java.lang.Object[] {  });
    }


    public void onConsentFormDismissed (com.google.android.ump.FormError p0)
    {
        n_onConsentFormDismissed (p0);
    }

    private native void n_onConsentFormDismissed (com.google.android.ump.FormError p0);

    private java.util.ArrayList refList;
    public void monodroidAddReference (java.lang.Object obj)
    {
        if (refList == null)
            refList = new java.util.ArrayList ();
        refList.add (obj);
    }

    public void monodroidClearReferences ()
    {
        if (refList != null)
            refList.clear ();
    }
}

Upvotes: 1

Gerald Versluis
Gerald Versluis

Reputation: 34013

Now with .NET 6, we can create native android apps without Xamarin.

Just to make sure we're on the same page; this still uses the exact same underlaying technique as Xamarin. Just the name is different and .NET MAUI and the iOS and Android bindings will be part of .NET directly instead of separate libraries.

Having that said, integrating AdMob will work the same as with Xamarin.Forms apart from some details. However, I highly doubt there is an AdMob library for .NET is compatible with .NET MAUI at this time. All the third-party libraries need to be made compatible with .NET MAUI and this might take some time. Keep your eye on the repository for updates. For instance of this library.

Upvotes: 4

Muhammad Imran
Muhammad Imran

Reputation: 5

Things that will be required to implement the AdMob is:

Your Android App AdMob Account App having the permission to access the INTERNET. You have to visit the Google AdMob official page and create your account. After creating the account on AdMob, click the button “Monetize New App” on Dashboard. The next step is to add your app. You can either provide your app via play store or add it manually (for manually entering the application, you need to provide the package name of your application). Once your app is added you need to set the type of ad unit you need to display on your app. Currently, Banner Ads, Interstitial Ads, Reward Videos, and Native Ads are supported. We will be concentrating only on Banner Ads

Upvotes: -3

Related Questions