Search Unity

Mobile Ads - Simple way to integrate ads in your app

Discussion in 'Assets and Asset Store' started by GleyGames, May 1, 2018.

?

What other advertisers we should add to our plugin?

Poll closed Oct 21, 2019.
  1. Facebook Ads

    64.7%
  2. AppLovin

    34.1%
  3. Tapjoy

    10.6%
  4. MoPub

    15.3%
  5. LeadBolt

    7.1%
  6. ironSource

    20.0%
  7. inMobi

    8.2%
  8. Mobusi

    0 vote(s)
    0.0%
  9. Appnext

    2.4%
  10. Appodeal

    8.2%
Multiple votes are allowed.
  1. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    240
    also admob banner not show in mobile not , here is my code
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class bannerAdmob : MonoBehaviour
    4. {
    5.  
    6.     private void Awake()
    7.     {
    8.         Advertisements.Instance.Initialize();
    9.     }
    10.     void Start()
    11.     {
    12.    
    13.         Advertisements.Instance.ShowBanner(BannerPosition.BOTTOM);
    14.      
    15.     }
    16.  
    17.  
    18.    private void OnDestroy()
    19.     {
    20.         Advertisements.Instance.HideBanner();
    21.     }
    22. }
     
  2. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    Hello,
    Please update your Admob SDK.
     
  3. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    Hello,
    Do the Initialize at the very beginning of your game, and call show banner only when you enter your game. It takes some time for the advertiser SDK to initialize
     
  4. breban1

    breban1

    Joined:
    Jun 7, 2016
    Posts:
    194
    Howdy!

    Love your asset, works great!

    Suggestion: I added static variables to enable/disable TEST ads for advertisers. Each has their own way of doing it, but having a handy way to turn them on/off at runtime (dev vs. production builds) is very handy.

    I voted on the poll, but was wondering if you had an ETA for ironSource (if you plan on adding it).

    Thanks!
     
  5. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    Hello,
    Thank you for your suggestion. We thought about it but we decided not to implement it because it can be implemented only for Admob and Unity ads. For other advertisers test mode is enabled from dashboard so a checkbox will not do anything. But if you requested it it will be implemented in about 2 weeks if no other problem will occur that requires a more urgent fix.

    About IronSource, it will be implemented around August since according to our poll MoPub has more requests so it will be implemented in July.

    We are very busy this summer, we intend to launch 2 other packages, so we are sorry you have to wait such a long time. If we will find more free time it will be implemented sooner.
     
    breban1 likes this.
  6. xdotcommer

    xdotcommer

    Joined:
    Aug 20, 2014
    Posts:
    33
    I followed the tutorial and...
    I'm getting these errors trying to run the Test Scene on iOS with Admob.
    I've set everything up and added all the payment info I can - they don't take the actual financial info until you hit $100.
    Am I missing some other step?

    Admob Interstitial Failed To Load Failed to receive ad with error: (null)
    Admob Rewarded Video Failed Failed to receive ad with error: (null)
     
  7. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    Hello,
    What Unity version are you using? If you send us an e-mail at gley.mobi@gmail.com we will send you a complete project with Admob already integrated to test it on your device to see if you are getting the same error. If you just created your IDs it takes some tome for the to receive live ads. Also do not forget to install the latest version of Cocoapods

    Also please take a look at this link:
    https://stackoverflow.com/questions...g-in-my-application-while-testing-ads-showing

    Maybe you can find something useful there.
     
  8. xdotcommer

    xdotcommer

    Joined:
    Aug 20, 2014
    Posts:
    33
    I'm using Unity 2019.1.5f1
    I have received the approval message from AdMob, which I setup yesterday.
    I have had Cocoapods setup for a while now.
    Also, the project sent, unfortunately, didn't work - with a similar error.

    Does this work for iOS?
     
  9. xdotcommer

    xdotcommer

    Joined:
    Aug 20, 2014
    Posts:
    33
    It looks like it's working now. Thank you
     
  10. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    Hello,
    Here is a video recorded on our iPhone proving that our plugin is working on iOS:
    https://www.dropbox.com/s/7jz7h3dddgtbat9/MobileAdsiOS.MP4?dl=0

    Also can you tell what was your problem? If other users have this problem to be able to advice them on how to fix it. Thank you
     
  11. The0Warrior

    The0Warrior

    Joined:
    Nov 19, 2017
    Posts:
    9
    Hi,

    I have just purchased your app and it's amazing but I have a question.

    In unity ads, there is this code "Advertisement.isShowing"

    Is there any code similar to this, in your app that I can use??
     
  12. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    Hello,
    We do not have such a method but with our plugin you can do something similar using the methods we already provided. Here is an example for interstitial ads:
    Code (CSharp):
    1. bool isShowing = false;
    2. if(Advertisements.Instance.IsInterstitialAvailable())
    3. {
    4.        Advertisements.Instance.ShowInterstitial(InterstitialClosed);
    5.        isShowing = true;
    6. }
    7.  
    8. private void InterstitialClosed(string advertiser)
    9. {
    10.       isShowing = false;
    11. }
    You can do the exact same setup for Rewarded Video.
    If you need more help let us know.
     
    The0Warrior likes this.
  13. The0Warrior

    The0Warrior

    Joined:
    Nov 19, 2017
    Posts:
    9

    Worked perfectly. Thank you
     
    GleyGames likes this.
  14. The0Warrior

    The0Warrior

    Joined:
    Nov 19, 2017
    Posts:
    9
    Hi, It's me again.

    I'm trying to implement Admob to my game but It always crashes on start

    After some time debugging I found this error:

    com.google.android.gms.internal.ads.zzyd.<init>
    java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.google.android.gms.ads.AdSize.isFluid()' on a null object reference

    Stack traces

    com.google.android.gms.internal.ads.zzyd.<init>
    com.google.android.gms.internal.ads.zzabb.zza
    com.google.android.gms.internal.ads.zzabb.zza
    com.google.android.gms.ads.BaseAdView.loadAd
    com.google.android.gms.ads.AdView.loadAd
    com.google.unity.ads.Banner$5.run Banner.java:278
    android.os.Handler.handleCallback Handler.java:743
    android.os.Handler.dispatchMessage Handler.java:95
    android.os.Looper.loop Looper.java:150
    android.app.ActivityThread.main ActivityThread.java:5665
    java.lang.reflect.Method.invoke Method.java
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run ZygoteInit.java:799
    com.android.internal.os.ZygoteInit.main ZygoteInit.java:689

    Can you please help me fix it.
    Thank you.

    Update: can be fixed by changing the banner type from smart banner to banner.
     
    Last edited: Jul 14, 2019
  15. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    Hello,
    Please make sure you have the latest version of Admob SDK installed and the latest version of our plugin.
    If so go to Assets->Play Services Resolver -> Android Resolver -> Force Resolve
    resolve.png

    If the problem persists let us know.
     
  16. The0Warrior

    The0Warrior

    Joined:
    Nov 19, 2017
    Posts:
    9
    Yup, still the same.

    Plugin: 1.5.7
    Admob :3.18.0

    Same error, after the logo directly it just crashes.
     
  17. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    Hello,
    Can you send us your .apk or can you send us your entire project at gley.mobi@gmail.com and we will fix that error for you if it is related to ads.
     
  18. The0Warrior

    The0Warrior

    Joined:
    Nov 19, 2017
    Posts:
    9
    Will do. Just give me some time since my internet here is really bad.

    Thank you.
     
  19. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    Please do not use beta versions to release your games. Wait for the official version to be released. Thank you.
     
  20. The0Warrior

    The0Warrior

    Joined:
    Nov 19, 2017
    Posts:
    9
    I'm really sorry for not answering here or on mail earlier because of some issue with my internet provider.
    Anyway, thank you so much for offering your help and providing the beta version info.

    The problem was with the beta version as you mentioned. It turned out that if I use the AdMob smart banner, the app just crashed. I used another old ad plugin that I had with the banner types as options, choose the standard banner type and it worked.

    I'm trying to reach for both, the Admob and unity team to fix this issue in the unity 2019.2 as I'm unable to downgrade to 2019.10
    Again, thank you so so much for the help and sorry for involving you in it.
     
  21. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    Hello,
    Since the issue is not related to our plugin is related to Admob SDK we cannot help you, but be sure that if an update to our plugin is required we will make it to fix any problems that might occur.
     
    The0Warrior likes this.
  22. Feidry

    Feidry

    Joined:
    Nov 8, 2013
    Posts:
    5
    Yeah, never mind. I ripped this asset out and replaced it with Unity's ads and made my own ad manager.
     
    Last edited: Jul 16, 2019
  23. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    Hello,
    Please update our plugin to the latest version adn add the Admob app ID to our settings window and hit save. Your app will not crash anymore.
    Please make sure your payment details are filled in your Admob account and your app is signed with your release key and your Admob ads will work.
    If you still have problems let us know.
     
  24. Feidry

    Feidry

    Joined:
    Nov 8, 2013
    Posts:
    5
    Just FYI, I did all of that but it doesn't matter any more. I've removed your asset and went a totally different direction.
     
  25. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    Hello,
    We are sorry to hear that, but since you decided to to go for a different ads solution we cannot help you fix your issue. Good luck with your game!
     
  26. unity_02V6rdimFzBLuA

    unity_02V6rdimFzBLuA

    Joined:
    Jul 15, 2019
    Posts:
    1
    i want to implement in real project not in test mode u have given..no C# code is availble to call code
     
  27. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    Hello, if you read the first post of this thread you will find the C# code but I will post it again:
    • Show Banner:
    Code (CSharp):
    1. Advertisements.Instance.ShowBanner(BannerPosition.BOTTOM);
    • Show Interstitial:
    Code (CSharp):
    1. Advertisements.Instance.ShowInterstitial(InterstitialClosed);
    2. private void InterstitialClosed()
    3. {
    4.      Debug.Log("Interstitial closed -> Resume Game ");
    5. }
    • Show Rewarded Video:
    Code (CSharp):
    1. Advertisements.Instance.ShowRewardedVideo(CompleteMethod);
    2. private void CompleteMethod(bool completed)
    3. {
    4.      if(completed)
    5.      {
    6.           Debug.Log("Give reward");
    7.      }
    8.      else
    9.      {
    10.           Debug.Log("Ad skipped -> no reward for you");
    11.      }
    12. }
    GDPR Compliance (it is not required if just Unity and/or Vungle sdk`s are used otherwise in mandatory).
    You have to get user consent for each new user that enters your app. To do this our plugin uses 2 methods:

    Code (CSharp):
    1. Advertisements.Instance.SetUserConsent(bool consent)
    Sets and also stores(saves on device) the user answer so all ads from now on will be displayed based on this settings.
    The default value(if is not set by the user) is true - will display targeted ads.

    Code (CSharp):
    1. bool Advertisements.Instance.UserConsentWasSet()
    If true, user already gave his consent, do not bother him anymore

    For more details you can check our documentation

    Or check our youtube video on how to implement ads in a real game:
     
  28. ALi_shah

    ALi_shah

    Joined:
    May 10, 2014
    Posts:
    9
    When Game Enter Play mode this error occurs how to fix this

    Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)
    The following scene GameObjects were found:
    MobieAdsScripts
     

    Attached Files:

  29. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    Hello,
    We do not spawn any objects on OnDestroy. Make sure you are not calling any of our plugin methods in on destroy.

    If the problem still persists send us steps to reproduce it or a project to test.
    Thank you!
     
  30. JRantajoki

    JRantajoki

    Joined:
    Jan 21, 2019
    Posts:
    3
    Hey. I have an issue where other Admob ads work fine, but banner crashes my game every time. This is even when just adding the TestAdsScene to my project and trying to run the banner that way. Any ideas?
     
  31. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    Hello,
    Can you send us your project by e-mail at gley.mobi@gmail.com or send us your crash report to see what is causing it. Nobody complained about this so far so we need more info.
     
  32. JRantajoki

    JRantajoki

    Joined:
    Jan 21, 2019
    Posts:
    3
    Allright, i can do that. I do think it might be a problem because i updated to latest Unity version. Banners did work before.. Teaches to jump the gun!
     
  33. ALi_shah

    ALi_shah

    Joined:
    May 10, 2014
    Posts:
    9
    Hi, Does this plugin support native ads type or not ? and i want to Native: Customizable ad format what shoud i do ?
     
  34. ALi_shah

    ALi_shah

    Joined:
    May 10, 2014
    Posts:
    9
    thanks for your help
     
  35. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    Hello,
    Our plugin does not support native ads, only banner, interstitials and rewrded video as it says on our store page
     
  36. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    It looks like there is an Admob bug with banners in Unity 2019.2 and it cannot be used right now, here is the official issue reported:
    https://github.com/googleads/googleads-mobile-unity/issues/987

    Until this will be fixed please do not use Unity 2019.2 if you need banner ads in your app. Interstitials and Rewarded videos are working with Unity 2019.2
     
  37. arifancatur

    arifancatur

    Joined:
    Aug 11, 2019
    Posts:
    3
    can u help me to guide with remote dekstop for first time ? i use team viewer.
    i had problem to add admob, cant resolve to. pls guide me for my projeck
     
  38. JRantajoki

    JRantajoki

    Joined:
    Jan 21, 2019
    Posts:
    3
  39. arifancatur

    arifancatur

    Joined:
    Aug 11, 2019
    Posts:
    3
    can i get support please,,, ?
     
  40. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    Hello,
    Sorry for the late replay, we are not doing integration via TeamViewer but we have a lot of tutorials on our youtube channel.
    Please check this 2:




    If you still have problems let us know.
     
  41. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
  42. TillmaniaLtd

    TillmaniaLtd

    Joined:
    Jan 29, 2013
    Posts:
    65
    your plugin seems to be switching the admob app-id and ad-unit ids over when built to xcode. Also there doesnt seem to be a way to add test devices?

    (edit: my bad, I had the wrong input in the native google-ad plugin settings)
     
    Last edited: Aug 19, 2019
  43. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    Hello,
    Is everything ok with our plugin or you found some issues? If you did, let us know and we will fix them
     
  44. TillmaniaLtd

    TillmaniaLtd

    Joined:
    Jan 29, 2013
    Posts:
    65
    The only issue is I can’t find a way to add test devices, is there a way to do this? Also is there any way to check if a banner is showing?
     
  45. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    Hello,
    Since our plugin is not an Admob integration plugin and the other advertisers do not have option to add test device we exclude it to maintain consistency over all advertisers. But to use test ads on admob simply use their test ad units from here:
    https://developers.google.com/admob/ios/test-ads

    Also don`t forget to add test app id as well or your app will crash.
     
  46. TillmaniaLtd

    TillmaniaLtd

    Joined:
    Jan 29, 2013
    Posts:
    65
    So are the ads shown during testing live ads on all platforms? Can’t that get your ad account banned?
     
  47. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    Just to be clear, test ads are not live ads you should change your IDs before publishing your app. The purpose of test ads is just to test your ad integration, are not linked to any google account, they are from Google and publicly available, as you can see on their documentation I`ve posted before.
     
  48. TillmaniaLtd

    TillmaniaLtd

    Joined:
    Jan 29, 2013
    Posts:
    65
    Ok that makes sense, but does the same apply to the other ad providers?
     
  49. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    482
    Each ad provider has his own way to enable test ads. For all other ad providers you can enable test ads from their dashboard. But if you are not clicking like crazy on ads and your game is ready to be published you can use live ads as well to test your game before submitting. The best way is to publish your game in alpha or beta on Google Play, download it from there and test it or use Testflight on iOS
     
  50. TillmaniaLtd

    TillmaniaLtd

    Joined:
    Jan 29, 2013
    Posts:
    65
    Sounds good. And is there any way to check if a banner is showing? So we can alter the UI to make space for the banner.