Admob for Xamarin made easy
In this tutorial I’ll show you how to monetize your Xamarin apps with AdMob using my MTAdmob plugin.

UPDATE 16/10/2019: MTAdmob is now Open Source on Github: https://github.com/marcojak/MTAdmob
UPDATE 20/07/2022: If you are looking for the MAUI version of this plugin, you can read about it here: https://www.mauiexpert.it/admob-for-maui-made-easy/
To help you to speed up your Xamarin development, I’ve created a set of plugins, one of them is MTAdmob. Thanks to this plugin you can add Admob banners and Insterstitials in just few lines of code. It couldn’t be easier than that and I’ll show you.
Install the plugin
First of all, right click on your Xamarin solution and select “Manage Nuget packages for Solution”

Visual Studio will open a new screen where you can search and install one or more nuget packages. In this case we can search for the MTAdmob plugin. Searching for MarcTron will show you all my packages (I’m sure you can find other useful plugins that I’ve written), and we can select the MTAdmob plugin as showed in the next image.
It’s very important that you install the plugin in your PCL/.Net standard project and in your platform projects (Android, iOS, UWP).
After the Admob plugin is installed we can add banners and insterstitials to our projects.
Add Ads to our project
MTAdmob plugin supports banner, interstitials and rewarded videos for Android and iOS. If you would like to see the plugin supporting also the UWP platform, let me now and I’ll add the support in a new version.
As I’ve said we can add Banners, Interstitials and Rewarded Videos ads to our project. Let’s start with the Banners
How to add an Admob Banner
An Admob banner is just a view inside our page. It means that we can add it using XAML or C#. First of all let’s see how to add an Admob banner using XAML.
Add an Admob Banner with XAML
In MTAdmob to use an Admob banner I’ve created a custom control called AdView, so to use it we can use this code:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:MarcTron.Plugin.Controls;assembly=Plugin.MtAdmob"
x:Class="Test.MTAdmob.MainPage">
<StackLayout>
<Label Text="Let's test an Admob Banner!"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand" />
<!-- Place the Admob controls here -->
<controls:MTAdView/>
</StackLayout>
In this example we have created a StackLayout with 2 controls: a label and an AdView (our Admob banner). Easy! Isn’t it???
The AdView control is basically a View so you can use all the properties you can think of like: HorizontalOptions, VerticalOptions, IsVisible…
In addition to these properties, I’ve added in AdView two other properties: AdsId and PersonalizedAds.
AdsId: Allows you to add the Banner Id (you can find it in your Admob account)
PersonalizedAds: This allow you to use non personalized ads. For example in case of GPDR. Of course it’s better to use personalized Ads.
To use these properties you can update the previous code to:
<controls:AdView PersonalizedAds="true" AdsId="xxxxxxxxxxxxxxxxxx"/>
Add an Admob Banner with C#
In case you don’t write your pages with XAML or you write your UI in C# or you want to add your view only in some cases, you can add your Admob Banner using this code:
using MarcTron.Plugin;
...
MTAdView ads = new MTAdView();
Of course you need to attach this View to your layout, but you know how to do it (If not, feel free to ask).
To use the custom properties you can change the previous code to:
...
MTAdView ads = new MTAdView();
ads.AdsId = "xxx";
ads.PersonalizedAds = true;
Also in this case, to add an Admob banner is INCREDIBILY EASY!!!
Global Custom Properties
As you have seen, the properties AdsId and PersonalizedAds belong to a single AdView. It means that you have to set them for every Admob Banner.
To make things even easier I’ve added the option to set these properties only once. To do so, you can use this C# code:
CrossMTAdmob.Current.UserPersonalizedAds = true;
CrossMTAdmob.Current.AdsId = "xxxxxxxxxxxxxxxx";
In this case all your Admob banner will show personalized ads and will have the same Id.
If you set local and global properties, the local ones will have higher priority.
Use of Banner Events
I’ve added 4 events to the Admob banner that you could find nice to have. These events are:
- AdsClicked When a user clicks on the ads
- AdsClosed When the user closes the ads
- AdsImpression Called when an impression is recorded for an ad.
- AdsOpened When the ads is opened
To use these events you can write this code:
AdView myAds = new AdView();
myAds.AdsClicked += MyAdsAdsClicked;
myAds.AdsClosed += MyAds_AdVClosed;
myAds.AdsImpression += MyAds_AdVImpression;
myAds.AdsOpened += MyAds_AdVOpened;
Of course you can use these events also if you have declared your AdView in your XAML code.
Admob Interstitials
Now that we know how to add Admob banners using my plugin MTAdmob, let’s see how we can add Admob Interstitials. If possible, to add an Admob interstitial is even easier. You just need a single line of code. Don’t you believe me? Look here how to show an Admob interstitial:
CrossMTAdmob.Current.ShowInterstitial("ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx");
I told you!!! That’s it!!! With that line of code you have just showed an Interstitial in you app. Of course you need to replace that string with the Insterstitial ID you can find in your Admob account.
Events for Interstitials
There 3 events that you can use with Interstitials:
OnInterstitialLoaded When it's loaded
OnInterstitialOpened When it's opened
OnInterstitialClosed When it's closed
Rewarded Video
From version 1.1 the plugin supports the amazing Rewarded Video too.
To show a rewarded video you just need a single line of code:
CrossMTAdmob.Current.ShowRewardedVideo("xx-xxx-xxx-xxxxxxxxxxxxxxxxx/xxxxxxxxxx");
Events for Rewarded videos
There are 7 events that you can use with the Rewarded video Ads:
OnRewarded When the user gets a reward
OnRewardedVideoAdClosed When the ads is closed
OnRewardedVideoAdFailedToLoad When the ads fails to load
OnRewardedVideoAdLeftApplication When the users leaves the application
OnRewardedVideoAdLoaded When the ads is loaded
OnRewardedVideoAdOpened When the ads is opened
OnRewardedVideoStarted When the ads starts
Initialization
Before you can use the Admob banners and Interstitials, you need to initialize it.
You need to do it only once so it makes sense to initialize it in the OnCreate method in Android and FinishedLaunching in iOS.
In your Android project add this line in your OnCreate method:
MobileAds.Initialize(this);
Remeber to add this to your AppManifest:
<!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
In your iOS project add this line in your FinishedLaunching method:
MobileAds.SharedInstance.Start(CompletionHandler);
private void CompletionHandler(InitializationStatus status){}
On iOS you need to add to your Info.plist file this:
<key>GADApplicationIdentifier</key>
<string>YOUR APP ID</string>
<key>GADIsAdManagerApp</key>
<true/>
IMPORTANT: If you receive errors compiling the code for iOS, install the package Xamarin.Google.iOS.MobileAds in your iOS project.
Some useful links
- Admob official website: https://apps.admob.com/
- Available on Nuget: https://www.nuget.org/packages/MarcTron.Admob
- Source Code: https://github.com/marcojak/MTAdmob
- Tutorial: https://www.xamarinexpert.it/admob-made-easy/
- Test Project:https://github.com/marcojak/TestMTAdmob
- To report any issue: https://github.com/marcojak/MTAdmob/issues
Conclusion
This Admob MTAdmob plugin is incredibly easy to use but in case you need help, or you want to suggest a new feature or for any other reason, write me.
Disclaimer
This plugin is free of charge and you may use it as you like, but regardless of your situation and usage, I won’t be held responsible of any loss.
It’s your responsibility to comply with every regulation around the word needed to show personalized and not personalized ads to the user.
Even though this plugin might support functionalities to help to comply with some regulations, it’s your responsibility to verify that everything works as intended and to implement any functionality that might be necessary.
September 10, 2022 @ 12:41 pm
Were you able to resolve this? I am facing the same problem
September 10, 2022 @ 12:32 pm
I faced app crash on Android 12
java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.ClassNotFoundException: Didn’t find class “com.google.android.gms.ads.MobileAdsInitProvider” on path: DexPathList
I tried to update the package and not able to find the existing Class and even the namespace has changed?
August 27, 2022 @ 2:19 pm
The lastest update (1.8.0) doesn’t work in the android project because doesn’t recognize the
Android.Gms.Ads namespace to register the MobileAds.Initialize(ApplicationContext); line.
April 14, 2022 @ 9:22 am
Hi,
I have the same problem as you do you have an idea to solve the integration problem with Monogame?
I managed to get a banner working on monogame on android but not interstitial and rewards
that’s why I find Marco Troncone code very interesting it works with ios and android
while searching I found old pieces of code but which no longer work
I think it’s possible to do the integration but so far I don’t have the soultion I think it’s a matter of views.
If you have any ideas feel free to share I will do the same
if you are interested in the piece of code that works I can send it to you
sorry for my english
April 4, 2022 @ 7:31 pm
Hi Marco
I feel free to ask:-)
Do you have any experience using this library with monogame and binding it to a view in monogame ios?
using MarcTron.Plugin;
…
MTAdView ads = new MTAdView();
Of course you need to attach this View to your layout, but you know how to do it (If not, feel free to ask).
Kind regards
Tommy
March 29, 2022 @ 5:32 pm
Have you figure out a way to use R8 or proguard? I had the same error and it went away when I disabled the code shrinker, but I would like to implement a code shrinker in my app. I think It might have something to do with com.google.gms class, because I had the same problem when I had ads implemented with my own code.
February 2, 2022 @ 12:48 am
Hello,
first of all thank you for your work
I would like to attach your library with FrameLayout
to view the interstitials and banners and why not the rewards
I work on a particular project without xaml “MONOGAME game engine”
thank you
February 2, 2022 @ 12:45 am
Hello,
first of all thank you for your work
I would like to attach your library with FrameLayout
to view the interstitials and banners and why not the rewards
I work on a particular project without xaml “MONOGAME game engine”
thank you
February 2, 2022 @ 12:23 am
Hello,
first of all thank you for your job
I would like to know how one can attach interstitial or banner on a FrameLayout, it is for a particular application “Monogame game engine” which does not deposit a Xaml file
thank you
February 2, 2022 @ 12:18 am
Hello,
first of all thank you for your work
I would like to know how one can attach interstitial or banner on a FrameLayout, it is for a particular application “Monogame game engine” which does not deposit a Xaml file
thank you
February 1, 2022 @ 12:21 am
Hi Marco,great job. Any chance to suppro
t “app open ads”
November 10, 2021 @ 6:24 pm
in the Initialize i get canot convert string to ioninetalizationcompletelistener, i use it without just MobileAds.Initialize(ApplicationContext); and i get blanck ads, any help? good job btw
November 10, 2021 @ 6:34 pm
Hi John, have you tried the demo code? Maybe it already works, but initially you don’t get actual ads, you need to set a test device to immediately see ads.
September 16, 2021 @ 3:57 pm
@Marco Troncone
How to display Rewarded interstitial, Native and App-Open Ads. Which method?
September 3, 2021 @ 10:26 am
Hi Marco, I have found that the AdsClicked event is not firing for me so have been using AdsOpened for now. But when the event is fired, ‘e’ is null. Is there anyway to capture which advert has been clicked, i.e. an advert id for the opened ad?
August 19, 2021 @ 8:29 pm
Hi Marco,
Thank you for the plugin, its great, however I am having some issues:
1) Rewarded video ads (30 seconds) are saying that you can receive the reward after 5 seconds, but this isn’t true, you have to watch the 30 second ad to receive the reward using the completion event trigger
2) (Recent problem) rewarded video ads have started showing 5 second ads. These ads do not provide the reward using the completion event trigger
3) It would be good to have the option of including interstitials in my app. However, I have found that they interfere with the rewarded video ads and vice versa. It seems to be that when you load a certain kind of ad, trying to load / call the other kind of ad won’t work. If I try to load an interstitial after a rewarded ad was loaded, the rewarded ad is still shown even using the interstitial function, and vice versa. This isn’t as much of an issue as the previous points though, which are breaking the implementation of the interstitials.
Thanks
June 3, 2021 @ 7:28 pm
Hi Jiri,
I use the latest version for several projects and it works just fine.
I’m wondering if there are some incompatibilities with other libraries you have in your projects.
June 2, 2021 @ 2:14 pm
Hello Blagovest,
Have the same issue after upgrading to latest version… Have you resolved that?
thanks
Jiri
May 18, 2021 @ 8:09 am
Hi Marco Troncone, can you update your test project with the new library 1.6.1 because I get a errors on Android project and not working for me.. (on iOS everything is fine)… Can you check here … https://stackoverflow.com/questions/67582133/fast-deployment-is-off-and-i-still-receive-error-message-for-android-project-on
May 5, 2021 @ 9:55 am
At the bottom on https://github.com/marcojak/MTAdmob it states:
“If you are builing your app for iOS on Windows without using your Mac, then MobileAds.SharedInstance will be null and the ads will not work.”, perhaps that’s the problem?
April 29, 2021 @ 8:31 pm
Hi Marco, I figured out the solution to that error. Turns out that code shrinkers (at least r8, not sure about proGuard) leave some important files outside. App shows ads and open correctly when r8 is disabled. Can’t figure out yet which file extension can I exclude from compression so I can get both ads working and app size reduced. But disabling code shrinker worked for me.
March 29, 2021 @ 9:47 pm
Hi. You should verify that the ads are actually loaded before showing them. Have a look at the demo app included, it will tell you how to work with the ads
March 29, 2021 @ 8:52 pm
Hi Marco, your plugin work very easy, but when I try to show the ad in OnAppearing() method when app starting the ad does not appear. In order not to pour all the code as a comment, please read the following link with my question – https://stackoverflow.com/questions/66859402/how-to-display-awarded-ad-in-method-onappearing-using-xamarin
March 29, 2021 @ 4:35 pm
Hello Marco,
thanks for your plugin. Have been using it for nearly a year in my app. After updating to the latest version 1.6.1 I am getting following error on compiling Xamarin.iOS project
/Users/user924118/Projects/ShoppkaGit/ShoppkaMobile/ShoppkaMobile/ShoppkaMobile.iOS/MTOUCH: Error MT1303: Could not decompress the native framework ‘FBLPromises.framework’ from ‘/Users/user924118/Projects/ShoppkaGit/ShoppkaMobile/ShoppkaMobile/ShoppkaMobile.iOS/obj/iPhone/Debug/mtouch-cache/FBLPromises.framework.zip’. Please review the build log for more information from the native ‘unzip’ command. (MT1303) (ShoppkaMobile.iOS)
I have installed latest version of both Xamarin.Google.iOS.MobileAds and Xamarin.Google.iOS.SignIn packages.
When downgraded back to version 1.5.7 I used earlier, the error is gone.
Any ideas what can be wrong?
thanks
Jiri
March 29, 2021 @ 11:21 am
Hi Marco, Today I try to use your plugin. I copy your code into my classes I try to download little bit old libraries like yours and everytime I receive a many errors like this:
/Users/pizhev/Documents/WeatherLocationInfo 1.7.4/WeatherLocationInfo.iOS/MTOUCH: Error MT5211: Native linking failed, undefined Objective-C class: GTMAppAuthFetcherAuthorization. The symbol ‘OBJC_CLASS$_GTMAppAuthFetcherAuthorization’ could not be found in any of the libraries or frameworks linked with your application. (MT5211) (WeatherLocationInfo.iOS)
Do you kno how can I fix this errors ?
Best Regards,
Blagovest Pizhev
March 14, 2021 @ 6:37 am
Guys I’m stuck. This was working fine for me until recently I had to push changes out and needed to update my code to the latest libraries. I have gone over every example I could find about getting this to work and from what I can tell I have it right. In my iOS project the app is crashing on MobileAds.SharedInstance.Start(CompletionHandler);. SharedInstance is null no matter what I do. Anyone have any suggestion on what might be causing this?
May 5, 2021 @ 9:59 am
Are you planning to implement the ne “Rewarded interstitial” (currently in BETA)?
May 5, 2021 @ 6:38 pm
Yes I do but I’m not sure yet when as currently I don’t have too much time.
I was also thinking to create a paid pro version just to help to maintain the plugin development and implement all the additional functionalities (like the multiple banner types that I’ve already started to implement).
Meanwhile the plugin is opensource so if someone wants to add new functionalities, I’ll be happy to merge them into the new version
March 12, 2021 @ 9:41 am
Hi, I am very new to this Ads/In-App stuff. I tried implementing your code for Banner ad. but nothing display even on blank page.
I can see a view with red BGColor but not seeing any ad.
My question is do I need to upload APK on admob or give reference of package name there if I am not seeing any ad?
Can you pls help ?
Thanks
March 12, 2021 @ 10:02 am
Hi Gayatri, no, you don’t need to upload your APK to visualise the ads. You need to use the test IDs or add your device id as test device. If you don’t do that’s you will not see ads and could risk to be banned by Google
March 11, 2021 @ 12:42 am
Hello Marco, thanks for writing this. I have been able to load your component in my app, and it compiles and runs, but I get an i’m getting an error that says “invalid property path syntax” when I add the OnPlatform to the AdsId property. As I said, it runs and shows the ads in the emulator, but the error doesnt go away. Here is the line that is having the error:
February 23, 2021 @ 6:07 pm
Does the plugin supports skadnetwork .
https://developers.google.com/admob/ios/ios14
February 19, 2021 @ 9:15 pm
Now i have this code, but the video fail to load. What’s wrong? It always shows the 6 DisplayAlert.
protected override async void OnAppearing()
{
base.OnAppearing();
CrossMTAdmob.Current.LoadRewardedVideo("ca-app-pub-3940256099942544/5354046379");//test id
SetEvents();
string pic = Preferences.Get("pic", "");
avatar.Source = "link.com" + pic;
await LoadInfos();
}
void SetEvents()
{
if (_shouldSetEvents)
{
_shouldSetEvents = false;
CrossMTAdmob.Current.OnRewardedVideoStarted += Current_OnRewardedVideoStarted;
CrossMTAdmob.Current.OnRewarded += Current_OnRewarded;
CrossMTAdmob.Current.OnRewardedVideoAdClosed += Current_OnRewardedVideoAdClosed;
CrossMTAdmob.Current.OnRewardedVideoAdFailedToLoad += Current_OnRewardedVideoAdFailedToLoad;
CrossMTAdmob.Current.OnRewardedVideoAdLeftApplication += Current_OnRewardedVideoAdLeftApplication;
CrossMTAdmob.Current.OnRewardedVideoAdLoaded += Current_OnRewardedVideoAdLoaded;
CrossMTAdmob.Current.OnRewardedVideoAdOpened += Current_OnRewardedVideoAdOpened;
CrossMTAdmob.Current.OnRewardedVideoAdCompleted += Current_OnRewardedVideoAdCompleted;
}
}
private void Current_OnRewardedVideoAdOpened(object sender, EventArgs e)
{
DisplayAlert("wow", "3", "ok");
}
private void Current_OnRewardedVideoAdLoaded(object sender, EventArgs e)
{
DisplayAlert("wow", "4", "ok");
}
private void Current_OnRewardedVideoAdLeftApplication(object sender, EventArgs e)
{
DisplayAlert("wow", "5", "ok");
}
private void Current_OnRewardedVideoAdFailedToLoad(object sender, MTEventArgs e)
{
DisplayAlert("wow", "6", "ok");
}
private void Current_OnRewardedVideoAdClosed(object sender, EventArgs e)
{
DisplayAlert("wow", "7", "ok");
}
private void Current_OnRewarded(object sender, MTEventArgs e)
{
DisplayAlert("wow", "8", "ok");
}
private void Current_OnRewardedVideoStarted(object sender, EventArgs e)
{
DisplayAlert("wow", "9", "ok");
}
private void Current_OnRewardedVideoAdCompleted(object sender, EventArgs e)
{
DisplayAlert("wow","ok","ok");
}
private void btnBuySoldier2_Clicked(object sender, EventArgs e)
{
CrossMTAdmob.Current.ShowRewardedVideo();
}
February 19, 2021 @ 8:47 pm
Can you please, give me an example?
February 19, 2021 @ 8:40 pm
private void btnBuy_Clicked(object sender, EventArgs e)
{
CrossMTAdmob.Current.LoadRewardedVideo(“ca-app-pub-3940256099942544/5354046379”);//test id
CrossMTAdmob.Current.ShowRewardedVideo();
}
That’s my code now. It’s in debug mode, but the video still doesn’t show
February 19, 2021 @ 8:44 pm
You cannot have the load the and show in the same method…you need to give time to load. Keep the load in this method and create an event that fires when the reward is loaded. You can then call the showrewardedvideo from that event
February 19, 2021 @ 7:03 pm
Can you give an example how to implement rewarded videos? I have a button, and when the user hits the button, i want to show the rewarded video, but nothing happens.
My code:
private void btnBuy_Clicked(object sender, EventArgs e)
{
CrossMTAdmob.Current.LoadRewardedVideo("ca-app-pub-3940256099942544/5354046379");//test id
}
February 19, 2021 @ 7:08 pm
That code loads a rewarded video, then you have to show it.
To do so, after the video is loaded, call this:
CrossMTAdmob.Current.ShowRewardedVideo();
February 12, 2021 @ 8:43 pm
Hello Marco,
My app has been in the play store for 6 months now. Now I got the following warning from Google:
Modified ad code: Resizing Ad Frames
This is a policy violation. You must fix this issue.
MODIFIED ADS: Publishers are not permitted to alter the behaviour of Google ads in any way. This includes resizing ad frames to cut off parts of ads or hiding the Ads by Google moniker.
I have no idea what they want from me.
Do I have to watch out for anything for Android? The banners also display correctly on 2.7-inch screens.
Jayaruban
February 12, 2021 @ 9:10 pm
Hi Jayaruban,
I doubt this depends on the plugin as I’ve seen online many messages like this.
I’ve seen that sometimes this is caused by the banner not covering the entire width of the screen.
Maybe it’s something that happens during a screen rotation?
Please let me know as this could be very interesting.
February 12, 2021 @ 9:29 pm
Hello Marco,
Thanks for the quick response.
My app always shows the content in portrait orientation with one exception. One side allows you to bring the app to landscape orientation to display more content. In landscape mode, I cover everything that was previously in portrait mode, including advertising. In landscape format, a previously invisible grid is made visible.
-> with Grid.RowSpan = “8” everything else is covered.
Could that be the problem? If so, how did Google find out?
Jayaurban
February 12, 2021 @ 9:33 pm
It could be but I’m not sure. Maybe they saw that the ads dimensions was different and they informed you.
I think the best option is to ask them for additional info.
Maybe they can send you a screenshot or explain what the problem is.
I use my plugin on few different apps and I’ve never had an issue but I don’t cover the ads, maybe that could be the problem
February 12, 2021 @ 9:47 pm
Hi Marco,
mhhhh, there is no Button to press to ask google. I will check again.
One more thing, the user can hide the advertising by buying the app. In this case I hide the banner (grid) with isVisible = false. In this case, am I not allowed to load the ad?
Could you please check this code, Just to check that I’m not doing anything seriously wrong.
Thank you in advance.
I set the Height always to “Auto” and then I display it in a grid like this:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<Grid Grid.Row="8" x:Name="gridAd">
<controls:MTAdView x:Name="myAds" IsVisible="true" VerticalOptions="EndAndExpand"></controls:MTAdView>
</Grid>
January 14, 2021 @ 5:59 am
Hello,
Is There Admob Native Ads Control Available in MarcTron.
January 17, 2021 @ 10:42 am
Hi Usama.
Not yet!
The code is online so anyone can implement it and send a merge request to update the code.
If no one will do it,
I’ll update the plugin to include the native ads!
December 14, 2020 @ 5:01 pm
Hi Marco,
Thank you for this plugin. my app working fine on iOS , however I have an issue with android project when I distributed my APK the app crashes and got this exception:
” E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.********************, PID: 17350
java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.ClassNotFoundException: Didn’t find class “com.google.android.gms.ads.MobileAdsInitProvider” on path: DexPathList[[zip file “/system/framework/org.apache.http.legacy.boot.jar”, zip file “/data/app/com.g.mypartyalbum-r7Su8m-EFRQLuShDDZ7lyw==/base.apk”],nativeLibraryDirectories=[/data/app/com.**.*************r7Su8m-EFRQLuShDDZ7lyw==/lib/arm, /data/app/com.***.**********-r7Su8m-EFRQLuShDDZ7lyw==/base.apk!/lib/armeabi-v7a, /system/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:6396)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5938)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5853)
at android.app.ActivityThread.access$1100(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassNotFoundException: Didn’t find class “com.google.android.gms.ads.MobileAdsInitProvider” on path: DexPathList[[zip file “/system/framework/org.apache.http.legacy.boot.jar”, zip file “/data/app/com.g.mypartyalbum-r7Su8m-”
Has anyone had this issue? I’m I missing something, Please help me
January 9, 2021 @ 12:02 pm
Hi Saja,
Have you had a look at the demo app on here: https://github.com/marcojak/MTAdmob/tree/master/Sample?
The demo works and it’s a great starting point to implement AdMob in you apps using MTAdmob.
I hope that helps you.
Let me know,
Marco
December 10, 2020 @ 4:06 am
hello sir, can we use this on uwp?
December 12, 2020 @ 12:54 pm
Ideally it’s possible but it’s not implemented yet as the Microsoft Ad Monetization was shut down and there is not yet an official replacement.
There are several providers so ideally it’s possible to change the source code to work with a particular ads provider.
November 27, 2020 @ 8:19 pm
Marco, thanks for this plugin, it’s awesome..
The version 1.6.0 is running perfectly for Android, but there is an error for iOS. (The application crashes before enter Main method).
Now, I’m using the version 1.5.8. Apparently it’s running perfectly.
November 19, 2020 @ 7:51 pm
Hello Brookey! I got it working but I used an even simpler approach without the plugin. I’m now wondering where I would go to inform myself as to how to optimize my possible ad revenue, ie personalization and stuff like that. This is a brave new world for me and it’s easy to get off track.
November 20, 2020 @ 5:09 am
Yes Thomas! New for me too! Good luck!
November 19, 2020 @ 1:47 pm
cannot convert from ‘MarcTron.Plugin.Controls.MTAdView’ to ‘Android.Views.View?’
Soo you saying its “easy ” to add but i am trying 1 hour.
Its imposible to add if you are not using XamarinForms
November 18, 2020 @ 4:18 pm
Thank you!!! I’m at the beta, pre-release stage and this issue has chewed up the last 2 days. I’m going to keep wrestling with it until I figure it out as I can’t move towards release until I have this sorted out.
November 19, 2020 @ 3:04 am
Tom. This is what I did…
Add the NuGet package MarcTron.AdMob to the whole Package (.NetStandard project and the Android and iOS projects – and UWP if required)
Add this line to the XAMLs (MainPage and MenuPage and others that will display ads):
xmlns:controls=”clr-namespace:MarcTron.Plugin.Controls;assembly=Plugin.MtAdmob”
Add the library to each of the C# programs that will display an ad:
using MarcTron.Plugin;
Using your own App ID, add this line to the OnCreate method in MainActivity.cs:
MobileAds.Initialize(ApplicationContext, “ca-app-pub-2269660344984691~2062918375”);
If MainActivity can’t see MobileAds, point it to “using Android.Gms.Ads;”. If that doesn’t work, Save All, Close Solution and open it again.
Was able to successfully deploy app to iPhone 11 at this point.
In the Finished Launching method in AppDelegate.cs in the iOS project, add these lines:
MobileAds.SharedInstance.Start(CompletionHandler);
// private void CompletionHandler(InitializationStatus status) { }
void CompletionHandler(InitializationStatus status) { } “private” in the second line was requested but threw an error so was deleted
If AppDelegate can’t see MobileAds, point it to “using Android.Gms.Ads”. If that doesn’t work, Save All, Close Solution and open it again.
Add this NuGet package to the iOS project: Xamarin.Google.iOS.MobileAds
Add these lines to the info.plist code in the iOS package:
GADApplicationIdentifier
YOUR APP ID
GADIsAdManagerApp
Was able to successfully deploy app to iPhone 11 at this point.
Right click on “YourApp”.Android, go to Android Manifest and update the Package name. In this case, net.grime.fartz. Save and close that.
Inserting your own AdMob App ID and application label, in your AndoidManifest.xml, replace the “application” line with :
Also in the AndroidManifest.xml, ensure the “uses permission” area includes
To the Android package, add the NuGet package xamarin.androidx.migration
Right click on “YourApp”.Android and select Properties and change the Application > Compile using… to Compile using Android 11 (might require a VS restart), the Properties Android Manifest Minimum Android Version to Android 7.0 (API Level 24 – Nougat) and the Target Android version to Android 11.0 (API Level 30 – R). (This should cater to the Nexus 6).
Was able to successfully deploy app to iPhone 11 at this point.
Was able to successfully deploy app to Nexus 6 at this point.
All that is left to do, in the individual XAMLs, with the valid AdsId, place every ad in its appropriate grid position per this:
<controls:MTAdView
x:Name=”MainPageAd”
AdsId=”{OnPlatform Android=’ca-app-pub-3940256099942544/6300978111’,
iOS=’ca-app-pub-3940256099942544/2934735716’}”
Grid.Row=”2”
Grid.Column=”0”
Grid.ColumnSpan=”3”
IsVisible=”true”
PersonalizedAds=”true”
VerticalOptions=”EndAndExpand”>
<controls:MTAdView.HeightRequest>
<x:OnIdiom>
<x:OnIdiom.Phone>50</x:OnIdiom.Phone>
<x:OnIdiom.Tablet>90</x:OnIdiom.Tablet>
<x:OnIdiom.Desktop>90</x:OnIdiom.Desktop>
</x:OnIdiom>
</controls:MTAdView.HeightRequest>
</controls:MTAdView>
Both iOS and Android devices display ads on every page. YAY!!!!
November 17, 2020 @ 11:49 pm
Tom. I had similar issues for days and sorted it all out just yesterday. You have to do a bit of a mash-up between the tutorial (above), the documentation at the NuGet site (https://www.nuget.org/packages/MarcTron.Admob#), and by looking at the code in the GitHub package (https://github.com/marcojak/TestMTAdmob).
November 17, 2020 @ 10:28 pm
I have solved my own problem by re-jigging the XAML to the following, which works first time, every time, on both iOS and Android.
<controls:MTAdView
x:Name="MainPageAd"
AdsId="{OnPlatform Android='ca-app-pub-3940256099942544/6300978111',
iOS='ca-app-pub-3940256099942544/2934735716'}"
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="3"
IsVisible="true"
PersonalizedAds="true"
VerticalOptions="EndAndExpand">
<controls:MTAdView.HeightRequest>
<x:OnIdiom>
<x:OnIdiom.Phone>50</x:OnIdiom.Phone>
<x:OnIdiom.Tablet>90</x:OnIdiom.Tablet>
<x:OnIdiom.Desktop>90</x:OnIdiom.Desktop>
</x:OnIdiom>
</controls:MTAdView.HeightRequest>
</controls:MTAdView>
November 17, 2020 @ 8:22 pm
Hello Marco; I’m working on a Xamarin app and want to have banner ads in it. I’ve followed your instructions to a T but when I run my test app on my smartphone it says “Deploy Successful” but the application never appears on my phone. Still works fine on my Windows desktop. Do you have any idea what the problem might be? I’ve been banging my head against the wall for 2 days now……
November 16, 2020 @ 6:34 am
Also, not all the time, but sometimes, in portrait mode, the Android ad disappears off the right side of the phone. I’d leave a screenshot but I don’t think this blog allows it.
November 16, 2020 @ 6:26 am
I’m having a problem reported previously on Android regarding ads not displaying until the device is rotated. I have seen the C# code you wrote and tried to emulate that in XAML but it doesn’t work:
<controls:MTAdView
x:Name="MainPageAd"
AdsId="{OnPlatform Android='ca-app-pub-3940256099942544/6300978111',
iOS='ca-app-pub-3940256099942544/2934735716'}"
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="3"
HorizontalOptions="CenterAndExpand"
VerticalOptions="Center"
BackgroundColor="White"
HeightRequest="60"
/>
Thoughts?
November 11, 2020 @ 8:22 pm
Unfortunately, the same problem is still present for me.
I have been waiting already for some time and it does not work on iOS. Test ads are shown without any problem.
On android, test and real ads are shown without any problem. However, I still have that problem on ios :/
I have also tried with the demo but the same behavior is also there. Only test ads are shown using my IDs :/
We are already having some requests but still 0 impression..
November 11, 2020 @ 8:45 pm
If the test ads are showing, then everything is working fine. Google doesn’t immediately serves ads to new apps or new accounts. And by policy you should never show a non test ads during development, they could ban you if you do. Publish your app when ready and it will be fine!
November 11, 2020 @ 11:50 am
Thanks a lot.
And that is the device ID I get with this?
string deviceID = Android.Provider.Settings.Secure.GetString(Android.App.Application.Context.ContentResolver, Android.Provider.Settings.Secure.AndroidId); ?
So when adding this device ID and my admob-id’s it should show a test banner on that device and real banners on all other devices, correct?
Sorry for the questions – I’ll buy you a beer when I get it to work
November 11, 2020 @ 8:46 pm
You can find the test is when run the app on your device inspecting the visual studio output console. Yes, you will see test ads on the test device and real ads on all the others!
November 11, 2020 @ 11:27 am
Hi. I am using your Sample App and it does show a test ad.
When I change the 2 ID’s to my AdMob id’s, I see nothing.
That’s the only thing I have to do, change these 2 ID’s, correct?:
and
Correct?
Might be that google doesnt yet serve me ads?
Thanks
November 11, 2020 @ 11:30 am
You can see the demo source code. Anyway mostly it’s just changing the Ids. Make sure to add your device ID as test device so you’ll see the test ads coming to your app as usually Google doesn’t serve ads for new accounts or new apps
November 11, 2020 @ 11:33 am
Thanks for your ultra fast response.
Where do I have to add my device id as test device?
November 11, 2020 @ 11:40 am
CrossMTAdmob.Current.TestDevices
November 8, 2020 @ 5:22 am
Hi, I continue making test, and it doesnt work yet, I used your sample in github from the github project and didnt work. I even use other computer with a new visual studio installation and the problem is still there. In android it work perfectly and the test ads are shown in IOs without issues. I updated the project nugget to the version of today and didnt work also (1.6.0).
November 8, 2020 @ 12:36 pm
I tested the demo again and it works fine.
Is it possible that your IDs are not correct?
When doing tests, remember to add your device id as test device so you can be sure that it works.
Sometime Google doesn’t serve ads especially if your account is new, but on a test device you should immediately be able to see test ads.
November 8, 2020 @ 12:39 pm
Me too. It works fine! I’m using AdMob and as I wrote few days ago the only problem can be is the server delay problem. Wait few days and it should work fine since test ad is ok.
November 6, 2020 @ 11:52 am
Man, you did a great job. Everything works the first time with a minimum of code, much better than native google tools, thank you very much!
November 8, 2020 @ 12:36 pm
Thank you very much.
I really appreciate your comment
October 30, 2020 @ 6:29 pm
Hi, I have been using your ad control from august without any problems until now, I dont know why but all the new project wont work when deploying for IOS, in android it works perfectly. I even try with my old projects that are working in the app store, without any success. My Iphone havent been updated to the ios 14, so I think that is not the issue. The only thing that changed was to update my visual studio, they are installed and have requests, but no impressions. Has anyone has this problem? How do I solve it? I can use the test ads without any problem.
October 28, 2020 @ 1:26 am
Hi, i need to attach a new banner or refresh the actually one. That’s my XAML:
C#(trying to refresh or attach a new banner on SwipeUp event):
MTAdView myAds = new MTAdView();
myAds.AdsId = “ca-app-pub-xxxxxxxxx/xxxxxxx”;
myAds.PersonalizedAds = true;
Am i doing this right? Or there’s a better way to attach a new banner/refresh a new one?
October 29, 2020 @ 6:20 pm
Hi Jonathan,
Unfortunately I cannot see your XAML, anyway you don’t have to refresh manually a banner.
It should change automatically according to your preferences in Google Admob.
October 23, 2020 @ 4:13 pm
I am having a similar problem (I also use VS Mac and C#). Using my AdId, and a device simulator I am able to load a reward ad and display it without issue. However, when I deploy to a physical device, I get Error 1 when loading the reward ad. I have deleted and recreated the ad unit without success. This behavior is consistent for both iOS and Android devices.
October 23, 2020 @ 3:51 pm
Error 1 is related to your IDs. Control that your appId and unitId are correct.
October 22, 2020 @ 4:47 pm
Hi Kadir,
Implementation can be done like this (Xamarin Forms and C#):
ATTrackingManager.RequestTrackingAuthorization((status) =>
{
if (status == ATTrackingManagerAuthorizationStatus.Authorized)
{
CrossMTAdmob.Current.LoadInterstitial(“ca-app-pub-1867474977092626/9591235865”);
}
});
For that You will need add reference:
using AppTrackingTransparency;
Before I’m personally checking if its a iOS 14 (or higher).
Remember that if user has turned OFF tracking permission for all apps (in iPhone settings) then Your message with request will NEVER appear. If it’s turned on then You will see message box with asking.
Custom message for permission You can set by adding NSUserTrackingUsageDescription property to Info.plist (and String eg. “This identifier will be used to deliver personalized ads to you.”).
October 21, 2020 @ 10:00 pm
Hi Paul,
I have very similar problem as yours. Still haven’t figured out how to solve it yet. Hope Marco could answer your question.
Besides that, I still need to find out how to manage to request user for IDFA permission. Could you share with me how you have managed to do that?
Thanks,
Kadir
October 20, 2020 @ 6:02 pm
Hi Marco, I’ve released iOS app a day ago (my first one) and found that Ads are not displayed (Xamarin Forms, Visual Studio for Mac, C#). However if I will use test ID it works (both physical device and simulator). I’m also able to ask the user about IDFA permission. But ads for my admob ID (ca-ap-…) don’t work on physical device (only simulator shows test id). Does it mean that AdMob didn’t connect my app yet (I can’t link it yet in AdMod panel). I read that apps are visible after some time. Or is it because of something else like missing libraries in Visual Studio? Should it work with iOS14? You wrote recently (it was August) that You’re planning to implement new sdk in Your solution. But I’m not sure You was able to do that since there’s no Google.iOS.MobileAds new version, etc…
On the other hand on Android Platform it all works fine. So I think I followed Your instructions correctly. So… It’s a great job with Your plugin.
Best wishes,
Paul
September 18, 2020 @ 4:00 am
Hi, Im getting an error in my XF Android project: Its a Map type app.
“Program type already present: com.google.android.gms.common.api.internal.zzb.”
and its giving me this error too:
“Error: XLS0414: The type ‘controls:MTAdView’ was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. ”
Im running
MarcTron.Admob 1.5.7
Xamarin.Forms 4.8.0.1451
Xamarin.Essentials 1.5.3.2
Xamarin.Forms.GoogleMaps 3.3.0
Xamarin.Google.iOS.SignIn 5.0.2.1
Xamarin.GooglePlayServices.Basement 71.1620.4
Xamarin.Build.Download 0.10.0
Ive read elsewhere I need to find the package, and update it which i have done but still cant build.
Does anyone know how I can find which nuget package has the com.google.android.gms.common.api.internal.zzb
thanks in advance.
August 28, 2020 @ 11:08 pm
Hi,
Could you pls update your GitHub code, MtAdmob, ?It’s based on older plugin version, once I update all and run the code, none of the adds show up, is reward loaded – false.
thanks,
Mike
August 20, 2020 @ 2:50 pm
Thanks for the quick answer. if I understand correctly, all applications that are not updated on iOS 14 will not work. iOS 14 will be released in September. Hopefully I got that wrong
August 20, 2020 @ 2:46 pm
Thanks for the quick answer.
if I understand correctly, all applications that are not updated on iOS 14 will not work. iOS 14 will be released in September. Hopefully I got that wrong 🙁
August 20, 2020 @ 2:49 pm
I’m sure we will have several months to update our apps and libraries, anyway I’ll try to update the library as soon as the code will be available
August 20, 2020 @ 1:51 pm
Hi Marco,
First of all thank you for everything.
Apple has changed the AppTrackingTransparency framework for iOS 14. Google started telling me today that I should update to GMA SDK 7.64.0. is this already implemented in your library? If not, are you planning an update?
Jayaruban
August 20, 2020 @ 1:57 pm
Hi,
I haven’t implemented it yet but if the sdk is available in Xamarin, I’ll implement it in this library. I need to investigate it better
August 12, 2020 @ 4:06 pm
Thank you very much Marco, I installed the missing packages, then the application worked well, thank you for this great plugin.
I have another question, when I set the MTAdView height to 50, for example, the ad does not appear completely in adView, on screens greater than 720 height, and on screens less than 720 the ad appears completely complete. I have read that the Smart Banner determines the height for devices whose height is less than or equal to 400 to 32 dp, for less than 720 to 50 dp, and for the largest from 720 to 90 dp, I want the height of the ad itself to be 50 even on phones that are Its height is greater than 720, and thank you again.
August 8, 2020 @ 2:57 am
When i install this plugin this error appears
Severity Code Description Project File Line Suppression State
Error Could not find 36 Android X assemblies, make sure to install the following NuGet packages:
– Xamarin.AndroidX.Lifecycle.LiveData
– Xamarin.AndroidX.Browser
– Xamarin.Google.Android.Material
– Xamarin.AndroidX.Legacy.Support.V4
You can also copy-and-paste the following snippet into your .csproj file:
August 8, 2020 @ 6:10 am
Hi Omar. It’s because we are moving toward AndroidX. You should as well if possible. Just install these packages and you’ll ready to go!
August 5, 2020 @ 9:52 pm
Hey , When I add google.services.ads the application dosen’t show in emulator so I can”t use ads in Xamarin android please any solution
August 5, 2020 @ 8:54 pm
Have you tried to use the test Id? You should always use them to be sure it works as many times the normal ids don’t work until you publish the app. There is also a test app you can use to see the code.
July 18, 2020 @ 12:31 pm
today when I try to use AdMob in Xamarin IOS App Blank by this package app not build and errors come :
Error: linker command failed with exit code 1 (use -v to see invocation)
error MT5209: Error: framework not found GoogleMobileAds
Error MT5201: Native linking failed. Please review the build log and the user flags provided to gcc: -ObjC -lsqlite3 -ObjC -lc++ -lsqlite3 -lz -ObjC -lz -lsqlite3 (MT5201)
I update everything to last version VSMaC , Xcode ,MacOS.
please help my .
July 18, 2020 @ 11:36 am
What version of the plugin are you using? Try to use the latest one: 1.5.6.
In case it’s not present, install also this package Xamarin.Google.iOS.MobileAds.
Let me know if it worked for you.
July 12, 2020 @ 3:23 pm
Hi
I want to stop banner ads programmatically, Because sometimes the ad is covered with other elements, then I get this issues:
Modified ad code: Resizing Ad Frames
MODIFIED ADS: Publishers are not permitted to alter the behavior of Google ads in any way. This includes resizing ad frames to cut off parts of ads or hiding the Ads by Google moniker
Thank you
July 6, 2020 @ 1:39 am
Hello, it’s seem the rewarded video don’t work anymore… the banner is work well but the rewarded video never appear and always still in “not loaded”. (i use your source code exemple)
July 6, 2020 @ 9:01 pm
Hi,
Thanks for letting me know.
I’m looking at the source code to see what’s happening, maybe Google changed something.
I’ll let you know asap
UPDATE: JUST CHECKED. IT WORKS OK! I’m using the Sample code from github: https://github.com/marcojak/MTAdmob and I’m able to load and show the rewarded video
June 30, 2020 @ 9:10 pm
Hi, I think the reason is that you load the interstitial just after showing it. Try to reload it after the Interstitial has been showed.
There is a demo app with the source code that you can use to see how it works on iOS.
June 16, 2020 @ 12:23 pm
Hello, I am showing and loading ads fine:
if (CrossMTAdmob.Current.IsInterstitialLoaded())
{
CrossMTAdmob.Current.ShowInterstitial();
CrossMTAdmob.Current.LoadInterstitial(MainPage.interstitialAdID);
}
But this works only once per session. To get another ad, I would have to restart the whole app only to get 1 ad. Why is this happening?
Then this is working fine on android, but never a test ad is shown on IOS. Is there a special requirement to get test interstials on iOS? The app isnt crashing, it is just not ever loading an ad on iOS.
Hope for replay.y
THank you
June 3, 2020 @ 2:46 pm
First of all thank you for this package.
But I can’t use this package with any Xamarin.Firebase’s packages (for android). For example, when I add the package to a project including Xamarin.Firebase.Analytics, errors occur.
1>C:\Users\myPc\.nuget\packages\xamarin.build.download\0.10.0\buildTransitive\Xamarin.Build.Download.targets(52,3): error XBD001: Download failed. Please download https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-basement/16.2.0/play-services-basement-16.2.0.aar to a file called C:\Users\myPc\AppData\Local\XamarinBuildDownloadCache\playservicesbasement-16.2.0.aar.
1> Download failure reason: The remote name could not be resolved: ‘dl.google.com’
1>C:\Users\myPc\.nuget\packages\xamarin.build.download\0.10.0\buildTransitive\Xamarin.Build.Download.targets(52,3): error XBD001: Download failed. Please download https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-tasks/16.0.1/play-services-tasks-16.0.1.aar to a file called C:\Users\myPc\AppData\Local\XamarinBuildDownloadCache\playservicestasks-16.0.1.aar.
1> Download failure reason: The remote name could not be resolved: ‘dl.google.com’
1>C:\Users\myPc\.nuget\packages\xamarin.build.download\0.10.0\buildTransitive\Xamarin.Build.Download.targets(52,3): error XBD001: Download failed. Please download https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-stats/16.0.1/play-services-stats-16.0.1.aar to a file called C:\Users\myPc\AppData\Local\XamarinBuildDownloadCache\playservicesstats-16.0.1.aar.
1> Download failure reason: The remote name could not be resolved: ‘dl.google.com’
1>C:\Users\myPc\.nuget\packages\xamarin.build.download\0.10.0\buildTransitive\Xamarin.Build.Download.targets(52,3): error XBD001: Download failed. Please download https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-measurement-base/16.3.0/play-services-measurement-base-16.3.0.aar to a file called C:\Users\myPc\AppData\Local\XamarinBuildDownloadCache\playservicesmeasurementbase-16.3.0.aar.
1> Download failure reason: The remote name could not be resolved: ‘dl.google.com’
1>C:\Users\myPc\.nuget\packages\xamarin.build.download\0.10.0\buildTransitive\Xamarin.Build.Download.targets(52,3): error XBD001: Download failed. Please download https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-base/16.1.0/play-services-base-16.1.0.aar to a file called C:\Users\myPc\AppData\Local\XamarinBuildDownloadCache\playservicesbase-16.1.0.aar.
1> Download failure reason: The remote name could not be resolved: ‘dl.google.com’
1>C:\Users\myPc\.nuget\packages\xamarin.build.download\0.10.0\buildTransitive\Xamarin.Build.Download.targets(52,3): error XBD001: Download failed. Please download https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-ads-identifier/16.0.0/play-services-ads-identifier-16.0.0.aar to a file called C:\Users\myPc\AppData\Local\XamarinBuildDownloadCache\playservicesadsidentifier-16.0.0.aar.
1> Download failure reason: The remote name could not be resolved: ‘dl.google.com’
1>C:\Users\myPc\.nuget\packages\xamarin.build.download\0.10.0\buildTransitive\Xamarin.Build.Download.targets(52,3): error XBD001: Download failed. Please download https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-iid-interop/16.0.1/firebase-iid-interop-16.0.1.aar to a file called C:\Users\myPc\AppData\Local\XamarinBuildDownloadCache\firebaseiidinterop-16.0.1.aar.
1> Download failure reason: The remote name could not be resolved: ‘dl.google.com’
1>C:\Users\myPc\.nuget\packages\xamarin.build.download\0.10.0\buildTransitive\Xamarin.Build.Download.targets(52,3): error XBD001: Download failed. Please download https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-common/16.1.0/firebase-common-16.1.0.aar to a file called C:\Users\myPc\AppData\Local\XamarinBuildDownloadCache\firebasecommon-16.1.0.aar.
1> Download failure reason: The remote name could not be resolved: ‘dl.google.com’
1>C:\Users\myPc\.nuget\packages\xamarin.build.download\0.10.0\buildTransitive\Xamarin.Build.Download.targets(52,3): error XBD001: Download failed. Please download https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-iid/17.1.0/firebase-iid-17.1.0.aar to a file called C:\Users\myPc\AppData\Local\XamarinBuildDownloadCache\firebaseiid-17.1.0.aar.
1> Download failure reason: The remote name could not be resolved: ‘dl.google.com’
1>C:\Users\myPc\.nuget\packages\xamarin.build.download\0.10.0\buildTransitive\Xamarin.Build.Download.targets(52,3): error XBD001: Download failed. Please download https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-analytics-impl/16.3.0/firebase-analytics-impl-16.3.0.aar to a file called C:\Users\myPc\AppData\Local\XamarinBuildDownloadCache\firebaseanalyticsimpl-16.3.0.aar.
1> Download failure reason: The remote name could not be resolved: ‘dl.google.com’
1>C:\Users\myPc\.nuget\packages\xamarin.build.download\0.10.0\buildTransitive\Xamarin.Build.Download.targets(52,3): error XBD001: Download failed. Please download https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-measurement-api/16.3.0/play-services-measurement-api-16.3.0.aar to a file called C:\Users\myPc\AppData\Local\XamarinBuildDownloadCache\playservicesmeasurementapi-16.3.0.aar.
1> Download failure reason: The remote name could not be resolved: ‘dl.google.com’
1>C:\Users\myPc\.nuget\packages\xamarin.build.download\0.10.0\buildTransitive\Xamarin.Build.Download.targets(52,3): error XBD001: Download failed. Please download https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-analytics/16.3.0/firebase-analytics-16.3.0.aar to a file called C:\Users\myPc\AppData\Local\XamarinBuildDownloadCache\firebaseanalytics-16.3.0.aar.
1> Download failure reason: The remote name could not be resolved: ‘dl.google.com’
May 23, 2020 @ 8:27 am
Hi Again, I downgraded packages to this and it worked.:) But I advise you keep updated to latest . Cheers.
– Xamarin.Google.iOS.Core (3.1.0.1)
– Xamarin.Google.iOS.MobileAds (7.47.0)”
May 23, 2020 @ 12:45 pm
Hi,
I’ tried the sample (you can find it here: https://github.com/marcojak/MTAdmob) and it works perfectly fine, so I think this is not directly related to the plugin but to something else.
Try the sample and let me know if it compiles for you.
Don’t use Xamarin.Google.iOS.MobileAds version 7.47.0 otherwise Apple will reject your code as it uses UIWebView that is deprecated.
You need to use MobileAds at least version 7.55.0
May 22, 2020 @ 8:27 pm
I do have other plugins but the project was working perfectly only change I did is that native project renderers to replace with yours.
May 22, 2020 @ 8:19 pm
I have already did it. It did not work I am sorry.
May 22, 2020 @ 8:21 pm
That’s strange, do you have other plugins installed (like the sign-in that was required in a previous version). Tomorrow I will try with the testmtadmob app to see if it works
May 22, 2020 @ 7:47 pm
Hello
Android works perfect but I get errors on iOS while building :
4> /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch @/Users/ozersenol/Library/Caches/Xamarin/mtbs/builds/KanAraBul.iOS/e5218ffadc6c47703d8913b818f3fe3d/obj/iPhoneSimulator/Debug/response-file.rsp –registrar:static “–gcc_flags=-ObjC -lz -lstdc++ -lsqlite3 -ObjC -lc++ -lsqlite3 -lz -ObjC -lz -lsqlite3 -ObjC -lc++ -lsqlite3 -lz”
4>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(842,3): error MT5210: Native linking failed, undefined symbol: _FIRInstallationIDDidChangeNotification. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
4>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(842,3): error MT5211: Native linking failed, undefined Objective-C class: FIRInstallations. The symbol ‘_OBJC_CLASS_$_FIRInstallations’ could not be found in any of the libraries or frameworks linked with your application.
4>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(842,3): warning MT5215: References to ‘System’ might require additional -framework=XXX or -lXXX instructions to the native linker
4>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(842,3): warning MT5215: References to ‘System’ might require additional -framework=XXX or -lXXX instructions to the native linker
4>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(842,3): warning MT5215: References to ‘System’ might require additional -framework=XXX or -lXXX instructions to the native linker
4>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(842,3): warning MT5215: References to ‘System.Net.Security’ might require additional -framework=XXX or -lXXX instructions to the native linker
4>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(842,3): warning MT5215: References to ‘System’ might require additional -framework=XXX or -lXXX instructions to the native linker
4>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(842,3): warning MT5215: References to ‘dl’ might require additional -framework=XXX or -lXXX instructions to the native linker
4>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(842,3): warning MT5215: References to ‘kernel32’ might require additional -framework=XXX or -lXXX instructions to the native linker
4>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(842,3): warning MT5215: References to ‘kernel32’ might require additional -framework=XXX or -lXXX instructions to the native linker
4>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(842,3): error MT5201: Native linking failed. Please review the build log and the user flags provided to gcc: -ObjC -lz -lstdc++ -lsqlite3 -ObjC -lc++ -lsqlite3 -lz -ObjC -lz -lsqlite3 -ObjC -lc++ -lsqlite3 -lz
4>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(842,3): error : linker command failed with exit code 1 (use -v to see invocation)
Apple Support – iTunes installed: ‘True’, Installation type: ‘Msi’
VS2019 16.0
ios: 13.5
Xamarin: 4.6
Xamarin.ios.Google.Core : 3.1.0.4
Xamarin.Google.ios.MobileAds: 7.57.0
MarcTron.Admob: 1.5.5
May 22, 2020 @ 6:49 pm
I’d suggest a clean and to delete the bin and obj folders, after that a rebuild should work.
May 19, 2020 @ 10:30 am
Love the library. Surprised no one has done something like it before. Please keep it active.
May 8, 2020 @ 5:15 pm
Hi Marco,
Something about the requirements for your plugin on iOS use UIWebView, and as a result my new app was rejected from the AppStore. They stopped accepting submissions with UIWebView references. I figured this might be something you weren’t aware of and just wanted to let you know. In the end I only needed banners, so I just created my own custom renderers on iOS and Android, but for future users you might need to update it, or else they won’t be able to submit to the App Store.
May 8, 2020 @ 4:22 pm
the UIWebview issue is in Xamarin framework and not Marco’s plugin. I just had to implement the mtouch arguments on my latest app release. I posted a comment to Xamarin team on when this will be fully removed and they said its in the works but for now add the mtouch arguments mentioned here:
https://devblogs.microsoft.com/xamarin/uiwebview-deprecation-xamarin-forms/
May 8, 2020 @ 5:25 pm
I originally thought that was the case, too, but adding that mtouch argument was not enough. I had to also remove Marco’s plugin before Apple wouldn’t reject the binary. After that, I did my custom renderer and the next build was also accepted. The only change to NuGet packages was to remove Marco’s and add the necessary Xamarin.Firebase and Xamarin.GooglePlayServices packages to set up my own ad views.
May 8, 2020 @ 5:28 pm
That’s very interesting. Probably the reason is that the library calls an older version of Xamarin.Forms. I’ll see if I can get rid of it or at least update it to the latest version. I’ll try to publish an update later today or tomorrow! Does anyone else had the same issue with Apple?
May 9, 2020 @ 10:27 am
I had a look at the code. It’s not possible to remove Xamarin Forms but I can update it. The only thing is that anyway the Xamarin version in your app replaces the one on the plugin (we cannot have 2 X.F. in the final build) this is why I’m not sure the problem comes from the plugin. Anyway I’ll update it
May 9, 2020 @ 6:15 pm
Now that my app has been accepted by Apple and published, I can look into this a little farther. All I did was add MarcTron.Admob to all three projects Xamarin.Google.iOS.SignIn to the iOS project. I haven’t even implemented it yet, just added the reference. My previous ad configuration should carry over since the instructions are the same for every method.
Then I double-checked that the “–optimize=experimental-xforms-product-type” mtouch parameter was still present and archived. About 10 minutes after upload, I got another email from Apple. My app now uses UIWebViews, when I had two uploads that were successful and one of those currently listed for download on the AppStore.
After that, I removed the NuGet packages and uploaded one last time. It was accepted and is available on TestFlight. I don’t know what else could be the problem since those packages were the only changes since it was submitted for review last night.
There’s gotta be something about using a lower X.Forms that prevents it from stripping UIWebView. Maybe because the older version’s WebView still uses UIWebView (even though I’m not using it).
We identified one or more issues with a recent delivery for your app, “<>” 1.0.4 (1). Please correct the following issues, then upload again.
ITMS-90809: Deprecated API Usage – New apps that use UIWebView are no longer accepted. Instead, use WKWebView for improved security and reliability. Learn more (https://developer.apple.com/documentation/uikit/uiwebview).
Best regards,
The App Store Team
May 9, 2020 @ 6:15 pm
Found the issue. It’s not Xamarin forms but the mobile iOS plugin. That one has a reference to uiwebview. I’m going to publish a new version after I’ve tested it, meanwhile you can still use my plugin updating manually the mobile iOS package to the latest version
May 9, 2020 @ 6:16 pm
Oh that’s awesome. Glad you were able to sort it out. Disregard my previous comment, I think we were commenting at the same time.
May 10, 2020 @ 2:41 pm
It won’t build for me with Google Signin 5.x in the project. If I revert to the older version it does build. It’s failing to link to a bunch of classes:
Build FAILED.
MTOUCH : warning MT5215: References to ‘System’ might require additional -framework=XXX or -lXXX instructions to the native linker
MTOUCH : warning MT5215: References to ‘System.Net.Security’ might require additional -framework=XXX or -lXXX instructions to the native linker
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: GTMAppAuthFetcherAuthorization. The symbol ‘_OBJC_CLASS_$_GTMAppAuthFetcherAuthorization’ could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: GTMKeychain. The symbol ‘_OBJC_CLASS_$_GTMKeychain’ could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: GTMOAuth2KeychainCompatibility. The symbol ‘_OBJC_CLASS_$_GTMOAuth2KeychainCompatibility’ could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: OIDAuthState. The symbol ‘_OBJC_CLASS_$_OIDAuthState’ could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: OIDAuthorizationRequest. The symbol ‘_OBJC_CLASS_$_OIDAuthorizationRequest’ could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: OIDAuthorizationService. The symbol ‘_OBJC_CLASS_$_OIDAuthorizationService’ could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: OIDIDToken. The symbol ‘_OBJC_CLASS_$_OIDIDToken’ could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: OIDServiceConfiguration. The symbol ‘_OBJC_CLASS_$_OIDServiceConfiguration’ could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: OIDURLQueryComponent. The symbol ‘_OBJC_CLASS_$_OIDURLQueryComponent’ could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5210: Native linking failed, undefined symbol: _OBJC_METACLASS_$_GTMAppAuthFetcherAuthorization. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
MTOUCH : error MT5210: Native linking failed, undefined symbol: _OIDOAuthErrorResponseErrorKey. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
MTOUCH : error MT5210: Native linking failed, undefined symbol: _OIDOAuthTokenErrorDomain. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
MTOUCH : error MT5210: Native linking failed, undefined symbol: _OIDResponseTypeCode. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
MTOUCH : error MT5201: Native linking failed. Please review the build log and the user flags provided to gcc: -ObjC -lsqlite3 -ObjC -lc++ -lsqlite3 -lz -ObjC -lz -lsqlite3
clang : error : linker command failed with exit code 1 (use -v to see invocation)
May 10, 2020 @ 4:01 pm
You don’t need Google sign-in anymore…I tried to compile and run the new package with the sample project and it worked fine. I had to clean the project and remove the bin and obj folders, then it worked totally fine
May 11, 2020 @ 1:05 pm
Ah, gotcha. I didn’t see 1.5.5 when I tried yesterday but now I do. Just archived and uploaded a build with the new one in and no rejection. I’m going to switch back to your plugin from my custom renderers because my custom renderer only handles banners. I might add other things down the road. This is awesome. Thanks for your quick response!
May 5, 2020 @ 7:34 pm
Hello Marco, how do I attach the banner display in C # to my layout. Is there any sample code?
May 5, 2020 @ 8:11 pm
There are several examples. You can see in the readme. You can add the object to your view (as a child of a layout)
May 5, 2020 @ 12:58 pm
Hello Marco. Is there a way to hide the ads while the page is loading? I tried ad.isVisible=false but that does not hide the ads
May 5, 2020 @ 12:09 pm
Hi Dani, strange, isVisible should work. If it doesn’t you could try to add a stacklayout around the ads and set it to false. I think it should work fine
May 5, 2020 @ 1:20 am
good night, how do i attach the banner to my layout with C #?
May 2, 2020 @ 8:16 pm
Hi Marco. Everything is working great, but banner ads appear cropped on the side. Any fixes?
May 2, 2020 @ 7:28 pm
Hi Danilo, without seeing the code is impossible to say. Maybe there is too much padding or margin so there is no space to entirely show the banner
May 1, 2020 @ 3:01 am
Good night, I have a problem, my application works normal with the ID test, however when I put the original ID it appears the following error message: Java.Lang.RuntimeException Message = Unable to get provider com.google.android.gms. ads.MobileAdsInitProvider: java.lang.IllegalStateException: **************************************** ************************************** * Invalid application ID. Follow instructions here: https://goo.gl/fQ2neu to * * find your app ID. * ************************************************* *****************************
What can it be ? sorry to bother you so much good night.
May 1, 2020 @ 6:30 pm
good afternoon, the error stopped, what was happening is that I had just created the ID, then this error appeared. But now I have another problem, I run my application, and the ads don’t appear, and with the test IDs it appears normally, do you have any idea what it might be?
May 1, 2020 @ 6:53 pm
Hi Michel, If you see the ads with the test id, then don’t worry, they will work. Google takes a bit to enable your account or new banners this is probably why you don’t see them
May 1, 2020 @ 7:01 pm
Ive had similar issues with the production ads not showing. I set up Mediation in Admob with a few networks. So that way if theres no Admob ads available in my location then other network ad’s may fill the spot.
Also check this link out
https://support.google.com/admob/troubleshooter/9092685?hl=en
May 2, 2020 @ 4:52 pm
an email arrived saying: “Add your payment method to show ads”, If I don’t add the payment method, won’t the ads appear? Sometimes it can be that, I didn’t add the payment form
May 2, 2020 @ 4:53 pm
Where this email came from? Are you sure is legit?
May 3, 2020 @ 3:08 am
yes it came from: [email protected]
So I don’t need to add the payment method for the real ads to appear?
May 3, 2020 @ 3:30 am
I am a little new in this world of development, I will finish my college only next year, so I am a little lost. For the ad to appear, do I need to publish it in the play store, or something? I am in the middle of developing the application, and I already wanted to test to see if the ads are really working. I know that the test ads work, but I wanted to see the real ads, to see if I did everything right.
Thank you so much for the help I am getting, I will always be grateful.
May 3, 2020 @ 8:39 am
You should avoid to show real ads while the app is not on the store otherwise Google could ban your account. You should only show test ads in development
May 3, 2020 @ 4:35 pm
Thank you very much, I will wait for the app to be ready, and then go up to the play store, I believe that when it goes up it will work, because the test ads work, as I mentioned I am a student, but as soon as I improve my situation I will buy you a coffee, thank you very much hugs !!
April 29, 2020 @ 10:39 pm
good night, i have a question.. just by putting the following code in xaml:
”
50
90
“,
and leaving it with my ID, does it already generate the ad normally? and does it change from time to time? or do I need to do something to change the ads from time to time?
First of all I would like to thank you for the MTAdmob plugin. Helped me a lot!!
April 29, 2020 @ 9:51 pm
Hi Michel. Unfortunately i cannot correctly see the code. You can set the id on xaml/c# for each banner or you can use the global AdsId that would be the same for each banner. It’s up to you if you want to keep the same Id or change it time to time. The plugin allows both the options
April 25, 2020 @ 4:13 pm
Hi Marco,
Is Admob mediation supported?
or do you have a plan in the future?
Regards
April 25, 2020 @ 7:27 pm
Hi Emre,
In this moment mediation is not supported but if possible on Xamarin, then I don’t see the problem to add that on this plugin.
In case you want, you can find the source code here:
https://github.com/marcojak/MTAdmob
and in case you could submit a pull request to enable the mediation.
If not, I will study the mediation to see how to implement it in MTAdmob.
May 1, 2020 @ 4:20 pm
Hi Marco,
Ad request is being sent by Admob. No impressions.
Facebook looks integrated with the Audience Network sdk, but no impressions.
AdColony said that it is necessary to integrate sdk.
No requests appear when I look at the administration panel of other ad networks.
Regards
April 22, 2020 @ 2:30 pm
ReleaseBuild gives error:
Severity Code Description Project File Line Suppression State
Error Mono.Linker.MarkException: Error processing method: ‘System.Void MarcTron.Plugin.MTAdmobImplementation::LoadRewardedVideo(System.String,MarcTron.Plugin.MTRewardedAdOptions)’ in assembly: ‘Plugin.MtAdmob.dll’ —> Mono.Cecil.ResolutionException: Failed to resolve System.Void Android.Gms.Ads.Reward.IRewardedVideoAd::set_CustomData(System.String)
at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
at Mono.Linker.Steps.MarkStep.ProcessQueue()
— End of inner exception stack trace —
at Mono.Linker.Steps.MarkStep.ProcessQueue()
at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
at Mono.Linker.Steps.MarkStep.Process()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
at Xamarin.Android.Tasks.LinkAssemblies.RunTask()
at Xamarin.Android.Tasks.AndroidTask.Execute() DiscoLightV1.Android
April 5, 2020 @ 1:09 pm
Hi Marco,
I have a strange behavior as soon as I integrate the banners into my app. The CPU of the app starts to rise steadily. The longer I use the app, the worse it gets. The CPU sometimes rises to 70% even though no actions are taken in the app. As soon as I comment out the banners, the CPU is below 1%. Do you have an idea why this could be?
Maybe I have to release the resources when changing pages?
Code:
I change to a new page like this:
Navigation.PushModalAsync(new pageOverview(), false);
Version: 1.4.5
I would be happy about every tip.
Regards
Jayaruban
April 13, 2020 @ 10:47 am
Hi Jayaruban,
I’m not sure what the problem could be, but in general I’d suggest you:
Every time you do something like +=, remember to have a -= to free the resources.
It could be possible that assign some events but never release them.
Let me know if this helps you.
April 30, 2020 @ 6:58 am
Hi Marco,
I have the problem when I use . I have adjusted my program and am no longer using a pushmodal.
March 29, 2020 @ 3:33 pm
Great Job. I just follow your tutorial today to implement Ads on my apps. It’s work fine on Android but for iOS I have to use Xamarin.Google.iOS.MobileAds 7.47.01 and Xamarin.Google.iOS.SignIn 4.4.0. Latest will cause lot of Build Errors. Maybe because I have to use Xamarin.Firebase.iOS.Analytics 6.0.4.1 for another plugin and it’s not also the lasts stable version of it.
March 28, 2020 @ 11:14 pm
when i request a rewarded video this error appear
no overload for method ‘ShowRewardedVideo’ takes 1 arguments
?
March 2, 2020 @ 9:28 am
Hi Marco, thanks for the great plugin!
First, you should update your code examples in this page to your new version, this would eleminate some confusion maybe.
Second, I have some problems with the interstitials… I try to load and show a interstitial ad and after closing the ad open modal the next page. But the next page is not shown. It is in the modalstack, but not visible. I just have this issue with the iOS part, android works like a charm. Is there something I have to do another way in iOS?
This is the code:
CrossMTAdmob.Current.ShowInterstitial();
await Application.Current.MainPage.Navigation.PushModalAsync(new View.Test(testInfo), false);
When I delete the first line, View.Test opens like expected, but with this line, the interstitial is open and after closing I just see the current page, not the View.Test
February 20, 2020 @ 12:11 am
Would there be any way to have multiple ad id’s in a list and have it randomize each time it displays?
February 20, 2020 @ 4:46 pm
Ideally it’s possible but why to use random IDs for the same banner?
February 22, 2020 @ 6:00 pm
my idea behind it is to change out the id’s each time the user goes to a different page. Also I thought it would make it easier to develop with. As of now I have to change out my id’s and put test ones in when i’m working on the app
February 22, 2020 @ 6:09 pm
You can set the ads id on every single page directly on the xaml, so you can have 100 different IDs for 100 different pages
February 22, 2020 @ 10:15 pm
Yes that is what i’m currently doing. But I thought for testing I have to go to every page and make sure I put admob test id’s in just so google doesn’t red flag me for using an emulator with my ad ids
February 9, 2020 @ 4:17 am
Hi I have the Android project working but I just downloaded your latest project from you git hub, I’m on a mac VS2019 and updated all XF nugets and im getting these errors in your project. Any thoughts on what might be the issue? Thanks in advance.
Forms Nuget:
MarcTron.Admob v1.4.5
Xamarin.Essentials v1.3.1
Xamarin.Forms 4.4.0.991640
Xamarin.GoogleiOS.SignIn 5.0.1.1
IOS project Nuget:
MarcTron.Admob v1.4.5
Xamarin.Essentials v1.3.1
Xamarin.Forms 4.4.0.991640
Xamarin.GoogleiOS.SignIn 5.0.1.1
Xamarin.GoogleiOS.MobileAds 7.47.0.1
Build FAILED.
MTOUCH : warning MT5215: References to ‘System’ might require additional -framework=XXX or -lXXX instructions to the native linker
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: GTMAppAuthFetcherAuthorization. The symbol ‘_OBJC_CLASS_$_GTMAppAuthFetcherAuthorization’ could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: GTMKeychain. The symbol ‘_OBJC_CLASS_$_GTMKeychain’ could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: GTMOAuth2KeychainCompatibility. The symbol ‘_OBJC_CLASS_$_GTMOAuth2KeychainCompatibility’ could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: OIDAuthState. The symbol ‘_OBJC_CLASS_$_OIDAuthState’ could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: OIDAuthorizationRequest. The symbol ‘_OBJC_CLASS_$_OIDAuthorizationRequest’ could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: OIDAuthorizationService. The symbol ‘_OBJC_CLASS_$_OIDAuthorizationService’ could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: OIDIDToken. The symbol ‘_OBJC_CLASS_$_OIDIDToken’ could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: OIDServiceConfiguration. The symbol ‘_OBJC_CLASS_$_OIDServiceConfiguration’ could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: OIDURLQueryComponent. The symbol ‘_OBJC_CLASS_$_OIDURLQueryComponent’ could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5210: Native linking failed, undefined symbol: _OBJC_METACLASS_$_GTMAppAuthFetcherAuthorization. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
MTOUCH : error MT5210: Native linking failed, undefined symbol: _OIDOAuthErrorResponseErrorKey. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
MTOUCH : error MT5210: Native linking failed, undefined symbol: _OIDOAuthTokenErrorDomain. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
MTOUCH : error MT5210: Native linking failed, undefined symbol: _OIDResponseTypeCode. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
MTOUCH : error MT5201: Native linking failed. Please review the build log and the user flags provided to gcc: -ObjC -lc++ -lsqlite3 -lz -ObjC -lsqlite3 -ObjC -lz -lsqlite3
MTOUCH : error MT5202: Native linking failed. Please review the build log.
clang : error : linker command failed with exit code 1 (use -v to see invocation)
1 Warning(s)
16 Error(s)
February 9, 2020 @ 8:04 am
Hi!
I copy here what Alejandro wrote few comments earlier:
“I got it to work in the 7.47 version of MobileADs. I had to install other dependences and uninstall SignIn.
The working NuGet packages are:
– MarcTron.Admob (1.4.5)
– Xamarin.Google.iOS.Core (3.1.0.1)
– Xamarin.Google.iOS.MobileAds (7.47.0)”
Try the same, it will work.
Cheers
February 9, 2020 @ 2:30 pm
yes! thank you that worked! I added those nugets in the ios project and in the forms project and removed the .signin nuget from both and your iOS app loads with the test advertisement.
thanks again for a great and easy to use plugin!
January 30, 2020 @ 5:49 pm
Help please!
I cant get the test ads to show up.
Im testing using the Google test ads on an android Amazon Fire HD10 running VS2019 community with Xamarin.Forms v4.4.0.991537
The placeholder is there but no ads show up.
Thanks in advance.
My implemented code:
My AndroidMainfest.xml code if have
My mainactivity code if have
// Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713
MobileAds.Initialize(ApplicationContext, “ca-app-pub-3940256099942544~3347511713″);
My xaml code if have
xmlns:controls=”clr-namespace:MarcTron.Plugin.Controls;assembly=Plugin.MtAdmob”
and
xaml.cs code if have
using MarcTron.Plugin.Controls;
January 30, 2020 @ 6:15 pm
looks like this website removed my manifiest.xml code. It should be
January 30, 2020 @ 6:45 pm
well this website wont let me post the androidmanifest.xml content. basically its the same 3 lines of the meta-data tags found on your github website.
https://github.com/marcojak/MTAdmob/blob/master/Sample/SampleMTAdmob.Android/Properties/AndroidManifest.xml
/Sample/SampleMTAdmob.Android/Properties/AndroidManifest.xml
January 30, 2020 @ 6:48 pm
Have you tried the test app to see if it works on your device? If it works you can copy the code from there or at least see the differences between that and your app
January 30, 2020 @ 7:28 pm
thanks, i got it working, turns out I was missing the Xamarin.GooglePlayServices.Ads nuget.
LOVE IT !!!
January 5, 2020 @ 10:17 pm
Hello Marco Troncone,
I would also like to thank you for your grate plugins.
Question i have is:
the Ads were showing for a few days now it seems the ads have stopped showing in my app, I have asked a few people that have the app downloaded and they say the same thing. The app was showing Ads now nothing
January 5, 2020 @ 10:18 pm
Hi Maverick. If the app was already published I don’t think the issue is related to the plugin. Are you sure, your Ads ID are still valid? Is it possible that Google blocked them?
January 7, 2020 @ 1:56 am
I checked and I didn’t see anything saying they were blocked
January 10, 2020 @ 10:28 pm
When i put the test ad id’s back in it works..But when i Add my own id’s its not working?
December 21, 2019 @ 4:10 pm
I am having the exact same issue with the packages… I tried with MarcTron.AdMob v1.4.5, Xamarin.Google.iOS.MobileAds v7.47 and Xamarin.Google.iOS.SignIn v5.0.1.
Finally, I’ve been able to get it working by uninstalling Xamarin.Google.iOS.SignIn and downgrading Xamarin.Google.iOS.MobileAds to v7.38. I publish this for anyone who also get in trouble to make it work on iOS.
And Marco, if you get to discover where the problem is, please update your plugin. I’d like to thank you, because this plugin is a lifesaver, you made all this Ads framework simple.
December 21, 2019 @ 3:21 pm
Thank you very much for your comment. Things like this give me the strength to improve this and other packages. Thanks again
December 22, 2019 @ 2:21 am
I got it to work in the 7.47 version of MobileADs. I had to install other dependences and uninstall SignIn.
The working NuGet packages are:
– MarcTron.Admob (1.4.5)
– Xamarin.Google.iOS.Core (3.1.0.1)
– Xamarin.Google.iOS.MobileAds (7.47.0)
December 6, 2019 @ 7:43 pm
Hey Marco,
Thanks a bunch for this awesome plugin. It saved me a lot of time. Great job!
I am stuck at one point though and was hoping you could help me!
I am almost done with my implementation but now I am facing a problem with testing the ad on my iOS test device. Even when I set “CrossMTAdmob.Current.TestDevices”, it only worked for Android device.
Initially I though I was doing something wrong, but when I checked your github repo, I saw that you have implemented this only for Android. Any plan of adding this for iOS plugin as well?
If not, can you give me some workaround for this?
December 6, 2019 @ 7:49 pm
Hi,
I’ll definitely implement it, I just forgot :).
If you know how to do it, you can create a pull request for this feature otherwise I’ll do it.
For now, you can try to use test ads Id for your app and banners
Cheers,
Marco
December 6, 2019 @ 8:25 pm
Thanks for quick response!
Unfortunately, I am under tight schedule so not sure when I will be able to create this pull request. But will definitely do it if you have not been able to do it by the time I am done with my work. 🙂
March 15, 2020 @ 10:05 pm
Hello,
Did you have a chance to do it? I have the latest version but CrossMTAdmob.Current.TestDevices doesn’t seem to work on iOS.
Thanks,
N.
November 25, 2019 @ 8:55 am
AdsClicked and AdsOpened not work for banners…
November 24, 2019 @ 7:13 am
I’m wondering. What a Issue ? I test my app on physical android device. When i depoly the App with WIFI running the ads display Easily without any error, BUT when i USE my SIM Data Connection, Nothing happens and ads are not showing . I have also Used another physical android device, but the Problem remains same . “In short WIFI show Ads & Mobile Data doesn.t Show Ads” …… Please Help Me Regarding this Issue.
November 24, 2019 @ 11:44 am
Hi Rizvi, do you have the same issue with the test app for MTAdmob? Try that one and see if it works there, maybe is something related to your App_ID or maybe to your data blocking the ads. I can tell you that the library makes no difference between Wifi and SIM Data.
November 22, 2019 @ 6:01 pm
I am Facing Problem in Interstitial Ads. In Your post Above You USe this code MobileAds.Initialize(ApplicationContext, “ca-app-pub-xxxxxxxxxxxxxxxx~xxxxxxxxxx”); AND in your github repository you have use CrossMTAdmob.Current.ShowRewardedVideo();
Please Clear this Point? Which Code I Use And Where To Use
November 22, 2019 @ 6:12 pm
Hi,
The first code
MobileAds.Initialize(ApplicationContext, “ca-app-pub-xxxxxxxxxxxxxxxx~xxxxxxxxxx”)
is used to initialize the Google ads plugin and it’s mandatory.
The second line of code is to actually show a rewarded video.
So you always have to use the first line (in the new version you have to add a line in your AndroidManifest as well), an you use the second line every time you want to show a rewarded video (remember to load one before showing it).
I hope this helps you.
Marco
November 19, 2019 @ 8:27 am
what could be the reason that Android does not show the test advertising? It works on iOS.
November 19, 2019 @ 11:06 am
Hi,
I can imagine two main causes:
1) The IDs are not correct for the Android project.
2) The Ads doesn’t have enough space to appear.
In the first case, just use the correct IDs.
In the second case, try to set the HeightRequest value (50 for phones and 90 for tablets).
This should solve the issue for Google Admob on Android.
Let me know if it solves the issue.
Cheers,
Marco
November 20, 2019 @ 8:04 am
Hi, thanks. Now it is working. It was the height. I have set it to 50 now.
Regards
Jayaruban
November 18, 2019 @ 2:34 am
Marco we get this eror Java.Lang.RuntimeException: ‘Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException:
how can we pass this error? i tried a lot of times but i cannot solve this problem :////// can you explain with images ?
November 19, 2019 @ 10:57 am
Hi Alper,
You need to edit your AndroidManifest in your Android project.
Inside “application” you need to add this line:
meta-data android:name=”com.google.android.gms.ads.APPLICATION_ID” android:value=”ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy”
It’s written in https://www.xamarinexpert.it/admob-made-easy/ undert the “Android Project (Important)”
This will fix the error. Remember to replace ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy with your ID
Cheers,
Marco
November 15, 2019 @ 10:20 am
First of all thank you for your work, it has greatly facilitated the use of Admob, Thank you.
Maybe it has nothing to do with your nuget, but since it was updated I can no longer compile it for iOS, before writing I have reviewed it, I have even returned to the previous version from a backup and it was fine, but when updating the package, then it gives These mistakes, if you knew where to look, it would help. Greetings
* linker command failed with exit code 1 (clang)
* framework not found GoogleSignIn ( error MT5209)
* Native linking failed, please review the buld log and the user flags provided to gcc: -ObjC- lsqlite3 – ObjC -lz -lsqlite3 (MT5201)
* Native linking failed. Please review the build log (MT5202)
November 15, 2019 @ 10:30 am
It sounds like you may not have included Xamarin.Google.iOS.MobileAds nuGet package
November 15, 2019 @ 10:35 am
Hi,
Thank you for your message.
The problem comes from the new Google.MobileAds.
To solve it, you have to install Xamarin.Google.iOS.SignIn 4.4.0 (Exactly this version, not the newer one).
This will solve the issue.
Let me know if it works.
Marco
November 15, 2019 @ 10:45 am
It is working!, Thank you very much! Enjoy the coffee I just invited you!
November 15, 2019 @ 10:46 am
Thank you very much!
MTAdmob is now Open Source | Xamarin eXpert
October 16, 2019 @ 2:27 pm
[…] Again if you need a tutorial, you can have a look at https://www.xamarinexpert.it/admob-made-easy/ […]
October 11, 2019 @ 5:32 am
Thank you for your library.
ios is fine, but android is not working banner,
i also check your git test admob sample, it’s same error for banner.
how can I use xamarin android service.
October 11, 2019 @ 9:00 am
Hi Andy,
What problem do you have in Android?
Let me know and I’ll help you with it.
Did you add in your manifest the metadata for your APPLICATION_ID?
meta-data android:name=”com.google.android.gms.ads.APPLICATION_ID” android:value=”ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy”
Anyway I’m having a look at the plugin and demo code and I’ll update it if necessary.
October 11, 2019 @ 9:06 am
Thank you for your reply,
i already added this code.
Android
properties/AndroidManifest.xml
MainActivity.cs
OnCreate
MobileAds.Initialize(ApplicationContext, “ca-app-pub-**********~**********”);
Forms
App.xaml
add
October 11, 2019 @ 9:10 am
Android
properties/AndroidManifest.xml
application android:label=”****”
meta-data android:name=”com.google.android.gms.ads.APPLICATION_ID” android:value=”ca-app-pub-*********~********” /
activity android:name=”com.google.android.gms.ads.AdActivity” android:configChanges=”keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize” android:theme=”@android:style/Theme.Translucent” /
/application
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /
<uses-permission android:name="android.permission.INTERNET" /
MainActivity.cs
OnCreate
MobileAds.Initialize(ApplicationContext, "ca-app-pub-**********~**********");
Forms
App.xaml
add
October 11, 2019 @ 1:21 pm
Hi Andy,
what error do you get?
Anyway there is a new version of the plugin (1.4.4).
I’d suggest you to update it.
If the error persists, Can you tell me what error do you get?
Thanks,
Marco
November 9, 2019 @ 2:13 am
Hi Marco,
I have added this code and updated the version of your plugin. The error is:
Java.Lang.RuntimeException
Message=Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException:
******************************************************************************
* The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers *
* should follow the instructions here: https://goo.gl/fQ2neu to add a valid *
* App ID inside the AndroidManifest. Google Ad Manager publishers should *
* follow instructions here: https://goo.gl/h17b6x. *
******************************************************************************
November 10, 2019 @ 11:44 am
Hi Steve,
You have to add this line in your AndroidManifest, as in this example (remember to change the value of the Application_ID):
meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"
let me know if it works.
Marco
November 10, 2019 @ 11:49 am
Thanks Marco,
I had been fighting with that specific problem thinking it would be fixed with a new update. I was adding those lines to the generated AndroidManifest instead of the source. It is all fixed now and Android has been published. This afternoon the journey of publishing on Apple store begins, maneuvering their hurdles to a final victory.
MarcTron.Admob version 1.4.3 is here | Xamarin eXpert
October 7, 2019 @ 9:04 pm
[…] There are many other things you can do with this great plugin for Admob. You can find the full documentation here: https://www.xamarinexpert.it/admob-made-easy/ […]
September 24, 2019 @ 2:08 pm
This is very helpful, as it is messy and confusing to implement oneself. THank you. UWP support would be great, but instead of admob (since i don’t believe they have a windows sdk) it can just leverage microsoft advertising and only implement the banner and interstitial ads on UWP: https://docs.microsoft.com/en-us/windows/uwp/monetize/developer-walkthroughs
September 26, 2019 @ 11:56 am
Hi Mark,
Thank you.
Are you suggesting I should add the UWP implementation?
If people are still using UWP, I could actually implement it in a new version.
Cheers,
Marco
October 6, 2019 @ 4:28 pm
This would definetly be a good idea. We are using UWP as well, delivering all platforms … Have you considered putting your plugin on github ? Would be glad to help you with some PRs 😉
December 1, 2019 @ 4:03 pm
Yes would be great for projects that leverage all 3 platforms. Or perhaps at a minimum make the library do nothing when added to UWP project so that it doesn’t break without extra code changes on dev’s side.
September 23, 2019 @ 10:59 am
Thank you for this plugin.
The plugin is very useful, the app works well but when I use android 9 Pie version and I run the app on my phone crashes the app, I know that the bug is in
xamarin.googleplayservices.ads
Or
Xamarin.GooglePlayServices.Ads.Lite
But I don’t know how I can make it work.
September 24, 2019 @ 11:59 am
Hi Yousuf
Add this to your AppManifest
Remember to use your actual APPID!
Cheers,
Marco
September 24, 2019 @ 2:11 pm
Thank you for the reply.
What should I add to AppManifest,
Can you explain more?
September 26, 2019 @ 11:58 am
Hi Yousuf,
Sorry for some reason, the blog didn’t copy the code to add to the AppManifest.
The code is:
meta-data android:name=”com.google.android.gms.ads.APPLICATION_ID” android:value=”ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy”
Marco
September 18, 2019 @ 11:02 pm
Hi Marco,
First of all, thanks a lot for your work, it is awesome 🙂
I’m using Interstitial Ad on my application but the ad is not showing in fullscreen. In portrait mode, it’s stuck at the left of the screen https://ibb.co/f9tPhJ5
Any idea if it is a bug ?
September 24, 2019 @ 12:00 pm
Hi Steeven
Thank you for your compliments.
I’m not sure if it’s a bug or not, but i’ll have a look and I’ll let you know
Cheers,
marco
August 22, 2019 @ 11:18 am
Great plugin but I have a problem. The banners works for me the test one is showing, the interistal ad also is showing for me (when made from c#) but:
1) My own ads from my admob account are not showing Im receving these errors:
08-22 12:18:26.272 W/DynamiteModule(18700): Local module descriptor class for com.google.android.gms.ads.dynamite not found.
08-22 12:18:26.277 D/DynamitePackage(18700): Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
08-22 12:18:26.285 I/Ads (18700): This request is sent from a test device.
08-22 12:18:26.430 W/DynamiteModule(18700): Local module descriptor class for com.google.android.gms.ads.dynamite not found.
08-22 12:18:26.433 D/DynamitePackage(18700): Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
08-22 12:18:26.436 I/Ads (18700): This request is sent from a test device.
08-22 12:18:26.485 W/Ads (18700): Not retrying to fetch app settings
08-22 12:18:26.990 I/Ads (18700): Ad failed to load : 3
08-22 12:18:26.991 I/Ads (18700): Ad failed to load : 3
2) The native ad also is not working not even the test one (ca-app-pub-3940256099942544/2247696110)
Can you help me fix this please?
August 24, 2019 @ 11:59 am
Hi John,
have you tried the test project here: https://github.com/marcojak/TestMTAdmob?
Download and try it, it contains all the features available in the plugin, so you can try it this works for you.
Let me know if it works.
Cheers,
Marco
August 11, 2019 @ 8:40 pm
hey. Thanks for this awesome plugin. Any plans for an open source code ? Would be great !
August 12, 2019 @ 9:51 am
Actually yes.
I’m publishing a new version that fixes some issues with iOS & events, and after that I’m thinking to make it open source so that more people can (hopefully) contribute to it.
Out of curiosity, why would you like to see it open source? isn’t easier to just use the nuget package?
Cheers,
Marco
August 20, 2019 @ 3:01 am
Yes its always easier to consume the nugget 🙂 . Even if your work is great, I would like to see how you implemented it and to participate (there’s always improvements to bring while xf versions & google admob go on. in case one day you have no time to maintain it for any reason, I dont want to be stuck.
August 7, 2019 @ 6:38 am
Hi Marco,
One more Issue, I’m not sure why but the Reward Ads are not being loaded in IOS (works perfectly in Android) I’ve checked and double checked the Ad Unit ID and it doesn’t seems to want to load it. The “OnRewardedVideoAdLoaded” isn’t even being fired. Have you seen this? I’m on the latest version of everything including your awesome plugin.
Also, Any way to set Smart Banner as the banner size Choice?
August 7, 2019 @ 1:44 pm
Hi Jason,
Thank you.
I’ve tested the new version on iOS (Simulator and device) and it works fine.
Have you tried to see the last code I put on github?
I totally changed it to show how to use the rewarded videos in multiple pages. Let me know if it works.
In this moment the banners for iOS and Android are SmartBanner.
I’m planning in the next version to add the possibility to change this option but for now SmartBanner should work well on all screens
August 6, 2019 @ 10:44 am
Hi Marco, thank you for your great plugin.
When using Banner Ad, how to avoid blank space if there is no impression, sometime many requests but less impressions, especially in iOS app.
August 7, 2019 @ 1:47 pm
Hi Eric,
you could intercept the banner events, and show the banner only if you get the event that the ads has been loaded correctly.
August 7, 2019 @ 4:21 pm
Thank you for your quick reply. But how do i check if banner ad not been loaded? which banner event should I use? Could you give me some guidance?
August 6, 2019 @ 9:59 am
Great job!, have you thought about adding the “keywords” property like the one in AdMob?
August 7, 2019 @ 1:46 pm
Hi Anthony,
What do you mean?
If it’s a feature common in Android and iOS, I could add it if requested.
August 2, 2019 @ 6:49 pm
REmoving, cleaning and reinstalling all the packages worked. I don’t know why I didn’t try that myself 🙂 Thanks a bunch buddy!
July 31, 2019 @ 10:57 pm
Hi, as soon as I install this nuget package to my ios project I get a lot of Linking errors :/ Android works just fine and on Ios I did install the mobileads nuget package as you suggested. I’m running latest version of everything on Visual studio 2019. Have you seen this? let me know if you want me to send you the exact error messages. I’ll add the first one just as an example:
mmon.targets(804,3): error : linker command failed with exit code 1 (use -v to see invocation)
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(804,3): error MT5214: Native linking failed, undefined symbol: _kDFPSimulatorID. This symbol was referenced by the managed member Google.MobileAds.DoubleClick.Request.SimulatorId. Please verify that all the necessary frameworks have been referenced and native libraries linked.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Co
August 2, 2019 @ 11:55 am
Hi Jason,
Not sure why you have this issue. I’d suggest to remove and install again the libraries (Admob and the Google ads for iOS).
Have you tried the test project to see if it works for you?
July 29, 2019 @ 8:26 am
Hi, thanks FOR YOUR LIBRARY, REALLY USEFUL.
i’VE TESTED A COUPLE OF THINGS AND THE VIDEOS AND INTERSTITIALS ARE WORKING FINE. tHE ONLY THING WHICH IS NOT WORKING ARE THE BANNERS.
i’VE INSTALLED YOUR PLUGIN AND HERE CODE:
xAML:
mAIN aCTIVITY:
MobileAds.Initialize(ApplicationContext, “ca-app-pub-2199979791362991~5921581412”);
mANIFEST:
tHE ADDS ARE NOT DISPLAYED. i AM USING xAMARIN 3.
tHANKS
July 30, 2019 @ 9:49 am
Hi,
probably it depends on the banner size.
Sometimes there is not enough height to show a banner.
Just for a test, try to add to the admob View, the property heightRequest = 60.
If it works then this will solve your problem.
If it doesn’t work, we can find a possible solution.
cheers,
Marco
June 28, 2019 @ 10:32 am
thank you for your great plugin, BUT İ CANT LOAD MY REWARDVİDEOS
June 10, 2019 @ 12:22 am
hello Marco, thank you for your great plugin, I am testing the Plugin and i can get in debug mode the test ads without problem, but when i change for the real app_id and ad_id of my admob real account, OnRewardedVideoAdLoaded SAYS IS NOT LOADING, when I see the OnRewardedVideoAdLoaded event, it says false for real ads id (the ads id and the account have many time of created), what do you think can be the problem ?
June 10, 2019 @ 2:00 pm
Hi Jason,
Is this a new Google account?
Consider that for the first few hours or days (up to 48 hours if I’m correct), it’s possible that you can only see the test ads and not the real ads.
Otherwise if this is not the case, are you sure that you have used the correct publisherId and the correct AdsId?
June 10, 2019 @ 12:11 am
hello Marco, thank you for your great plugin, I am testing the Plugin and i can get in debug mode the test ads without problem, but when i change for the real app_id and ad_id of my admob real account, OnRewardedVideoAdLoaded SAYS IS NOT LOADING, CAN YOU
June 9, 2019 @ 12:01 am
HI FIRST OF ALL THANK YOU FOR THIS WONDERFUL PLUGIN. EVERYTHING WORKS FINE BUT HOW DO I CHECK IF THE VIDEO HAS BEEN UPLOADED. ALSO HOW DO I USE THE CONTROLS TO AVOID GIVING POINTS WHEN THE VIDEO IS CLOSED. I’M SORRY FOR MY BAD ENGLISH.
June 9, 2019 @ 11:39 am
Hi Baris,
Thank you for your comment.
I think you are talking about the Rewarded Video.
In this case you can use the OnRewardedVideoAdLoaded event to see when a video is loaded.
To control is the user has seen the video you can use the event OnRewarded. This event will be called if and only if the uses has watched the video to get a reward.
I hope it can help you.
For any questions, ask me and I’ll be happy to reply
Marco
May 31, 2019 @ 10:04 pm
Hello,
I integrated MarcTron.Admob into my project and received several bugs. I downloaded and ran the example from Github. Also the version of Github shows after compiling 117 errors.
What am I doing wrong?
I’m really desperate, I would be very happy about any help.
I am using:
Visual Studio Community 2019 for Mac
Version 8.0.8 (build 2)
Xamarin.Mac 5.6.0.2
The first 5 error are:
/Users/test/Downloads/TestMTAdmob-master/TestMTAdmob/TestMTAdmob.iOS/clang: Error: linker command failed with exit code 1 (use -v to see invocation) (TestMTAdmob.iOS)
/Users/test/Downloads/TestMTAdmob-master/TestMTAdmob/TestMTAdmob.iOS/MTOUCH: Error MT5214: Native linking failed, undefined symbol: _kDFPSimulatorID. This symbol was referenced by the managed member Google.MobileAds.DoubleClick.Request.SimulatorId. Please verify that all the necessary frameworks have been referenced and native libraries linked. (MT5214) (TestMTAdmob.iOS)
/Users/test/Downloads/TestMTAdmob-master/TestMTAdmob/TestMTAdmob.iOS/MTOUCH: Error MT5211: Native linking failed, undefined Objective-C class: DFPInterstitial. The symbol ‘_OBJC_CLASS_$_DFPInterstitial’ could not be found in any of the libraries or frameworks linked with your application. (MT5211) (TestMTAdmob.iOS)
/Users/test/Downloads/TestMTAdmob-master/TestMTAdmob/TestMTAdmob.iOS/MTOUCH: Error MT5211: Native linking failed, undefined Objective-C class: DFPCustomRenderedAd. The symbol ‘_OBJC_CLASS_$_DFPCustomRenderedAd’ could not be found in any of the libraries or frameworks linked with your application. (MT5211) (TestMTAdmob.iOS)
/Users/test/Downloads/TestMTAdmob-master/TestMTAdmob/TestMTAdmob.iOS/MTOUCH: Error MT5214: Native linking failed, undefined symbol: _GADUnifiedNativeStarRatingAsset. This symbol was referenced by the managed member Google.MobileAds.UnifiedNativeAdAssetIdentifiers.StarRatingAsset. Please verify that all the necessary frameworks have been referenced and native libraries linked. (MT5214) (TestMTAdmob.iOS)
June 1, 2019 @ 4:26 pm
Hi Jay24.
The problem is that you need to install also the package Xamarin.Google.iOS.MobileAds in your iOS project.
Do it and it will work fine.
I’ve updated the plugin to the version 1.3 so it’s better if you can update the MTAdmob package as well.
April 26, 2019 @ 4:08 pm
Is there the ability to add test device ID’s so the ads will display when testing on physical devices vs. the emulator? I’ve tried adding a test Device in the MainActivity.cs after the MobileAds.Initialize but I still receive the error in the App output that the ads fail to load and to add the test device.
April 26, 2019 @ 6:16 pm
Figured it out – sorry I didn’t realize the Test devices were part of CrossMTAAdMob.Current. Great plugin. Many thanks.
April 19, 2019 @ 2:55 am
nOT SURE WHY FOR ME IT IS NOT WORKING, DO YOU HAVE A DEMO (GITHUB SOURCE) ?
April 19, 2019 @ 10:39 am
Yes, I’ll try to publish it this afternoon (I’ll write the link on the post and on a message).
Meanwhile If you give me more information, I can try to help you. What problem do you have with the plugin?
April 23, 2019 @ 6:28 pm
Hi Douglas,
I’ve added the demo project on Github. You can download it here: https://github.com/marcojak/TestMTAdmob
If you have any issue with it let me know, and I’ll try to help you
April 11, 2019 @ 1:42 pm
hi mr. marco
ı havent found out what ı am missıng but ı made all wrıttens step by step but when ı make archıve and transfer apk fıle to andorıd phone ı cant see my banner ads (google admob – Not testıng values)
April 11, 2019 @ 3:00 pm
Hi Ahmet,
Does it work in test mode?
If it works in test mode, then it’s possible that Google still has to authenticate your account so you’ll need to wait few hours (I think up to 24 to receive actual ads).
If it doesn’t work in test mode, have you tried to rotate the phone to see if you see the banner? sometimes you don’t have enough vertical space to show the ads. In that case you should set “HeightRequest” for the banner.
Have you added your Ids for the Google Admob?
Let me know if it solves your issue, otherwise we’ll continue to investigate.
April 5, 2019 @ 8:12 pm
thank you so much marco. this is what I’m looking. ı trıed many times but ıt doesn’t work ın my project.
I used that for Rewarded Videos but I got error lıke that {System.NotImplementedException: This functionality is not implemented in the portable version of this assembly.}
April 6, 2019 @ 11:37 am
You should install the library in every project, so your .NetStandard project AND your Android and iOS projects.
If you install it only in your .NetStandard project, it will not work.
April 5, 2019 @ 2:25 pm
REally nice PLugin, but unfortunately it’s not ok for Interstitials. As the load + show is in one function. The problem is, when you call it, the load takes 1-5 seconds (in the background), then show() is called. This makes it useless, as you cannot block your app for 5 seconds before displaying the Ad. Suggestion: in the constructor, already call load() for the app, and the current ShowInterstitial() should just call show(), which should be already loaded. Right after the .show(), you should re-load the next ad (still in the ShowInterstitial() ).
Or, just make these functions public, and let the users call those.
April 5, 2019 @ 5:22 pm
Hi Zoli,
Thank you,
This is a very good suggestion.
I’ll try to change it during the weekend so that I can release soon a new version with the changes suggested.
April 8, 2019 @ 5:42 pm
Hi Zoli,
I’ve published the new version 1.2 of the MTAdmob plugin.
Now there are 2 methods to Load and Show the plugin so you have total control over the interstitials and rewarded videos.
For example to load an interstitial the method is “LoadInterstitial”. To show it is “ShowInterstitial”.
There are also new methods to check if an interstitial or rewarded video are loaded.
March 24, 2019 @ 8:27 pm
First of all thanks a lot for your plugins. This plugin and the SQL one has helped me a great deal.
The interstitial works fine, but the banner ad gives me an error.
System.TypeInitializationException: The type initializer for ‘MarcTron.Plugin.Controls.AdView’ threw an exception.
March 25, 2019 @ 3:33 pm
Hi J0hs,
Thanks for your comment.
Can you give me more info about the error?
What version of the plugin are you using? What version of Xamarin.Forms?
On which platform do you get the error?
The more information I get, the better I can help you.
If you have also code that you thing makes sense to share,
you can add an issue here:
https://bitbucket.org/marcojak81/mtadmob/issues
Thank you
March 28, 2019 @ 1:04 pm
I used my own implementation for the banner instead, and now it is working as intended. For the interstitial, I am still using the plugin.
March 28, 2019 @ 3:52 pm
That’s good!
But I’m sorry the banner didn’t work for you.
What version of Xamarin.Forms are you using?
Add Admob Rewarded video Ads to Android and iOS | Xamarin eXpert
March 22, 2019 @ 7:10 pm
A detailed tutorial on how to use the plugin:
https://www.xamarinexpert.it/blog/add-admob-rewarded-video-ads-to-android-and-ios-with-a-single-line-of-code/
March 21, 2019 @ 12:04 pm
Hello,
It can be interesting to have onRewardedVideoCompleted() and onAdClosed() for reward and interstitial
TY
March 22, 2019 @ 3:19 pm
I’m releasing the new Version of the Admob plugin on Nuget now, so it should be available in the next hour top.
This version 1.1 adds the Rewarded Video Ads and Events for Interstitials and Rewarded Videos.
I’ll update this post and I’ll write another one to explain how to use the rewarded Videos on Android and iOS
March 22, 2019 @ 3:32 pm
Hello I found an Issue, the banner ads appear only when screen rotate
Same ISSUE HERE:
https://forums.xamarin.com/discussion/145122/admob-appears-only-after-rotation
March 22, 2019 @ 6:24 pm
Hi Eddy,
The issue is not related to the plugin but on how Xamarin.Forms handles the height of the controls in a page.
To solve the issue you can use the code written here:
https://bitbucket.org/marcojak81/mtadmob/issues/1/admob-appears-only-after-rotation
March 20, 2019 @ 12:12 pm
Hello,
good jobs.
How get event for interstitial and reward ads ?
March 20, 2019 @ 8:31 pm
UPDATE: BANNERS, INTERSTITIALS AND REWARDED VIDEOS ARE NOW SUPPORTED.
In this moment I’ve added only events for banners. I’ll try tomorrow to update the nuget package to add events also for interstitials.
Are there any events/features you would like to see there?
Marco