Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by scabbyoldbat · May 25, 2021 at 06:37 PM · androidadvertising

Admob ad won't show on phone, but works in editor

Hi, I made a simple game in my free time and tried to figure out how to add more and more stuff to it. The thing I can't seem to get to work are advertisements. It works just fine in the editor, but when I build to an apk and launch the game on my phone, the ads don't work.

here is the code i used for the ads: { [SerializeField] private GameObject _transitionScreen;

 string App_ID = "(this contains my app id in the code)";
 //testID
 string RewardedAdID = "ca-app-pub-3940256099942544/5224354917";
 //echt ID
 //string RewardedAdID = "(this contains my ad id in the code, but for now i use the testID above)";

 private RewardedAd rewardedAd;
    
 public void Start()
 {
     MobileAds.Initialize(initStatus => { });
     this.rewardedAd = new RewardedAd(RewardedAdID);
     // Create an empty ad request.
     AdRequest request = new AdRequest.Builder().Build();
     // Load the rewarded ad with the request.
     this.rewardedAd.LoadAd(request);
     // Called when the user should be rewarded for interacting with the ad.
     this.rewardedAd.OnUserEarnedReward += HandleUserEarnedReward;
     // Called when the ad is closed.
     this.rewardedAd.OnAdClosed += HandleRewardedAdClosed;
 }

 public void HandleUserEarnedReward(object sender, Reward args)
 {
     PlayerStats.Fuel = 100;
     PlayerStats.Health = 100;
 }
 
 public void UserChoseToWatchAd()
 {
     if (this.rewardedAd.IsLoaded())
     {
         this.rewardedAd.Show();
     }
     else
     {
         //show a screen that says an ad should be displayed but it's not working
         _transitionScreen.SetActive(true);
     }
 }
 public void HandleRewardedAdClosed(object sender, EventArgs args)
 {
     // Create an empty ad request.
     AdRequest request = new AdRequest.Builder().Build();
     // Load the rewarded ad with the request.
     this.rewardedAd.LoadAd(request);
 } 

So, in the editor I can click on the button, I get the test ad, and I get the reward. Health and fuel are refilled alt text

But if I run it on my phone nothing happens, no ad, no reward, not even the "transitionscreen" which is just a canvas with a textbox in it that says "there should be an ad here but it doens't seem to work".

I looked around on forums and saw similair questions pop up, but couldn't find a solution. Can anyone help me with this? (Admob account was activated over a month ago, app_ID is in the manifest, device ID of my phone was entered as a testdevice. It's probably something silly that I'm overlooking, but I can't find it...

screenshots.png (252.7 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Jojoanse · Sep 08, 2021 at 10:16 PM

Hi, I have the same problem. How did you solve it? Thanks.

Comment
Add comment · Show 7 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image scabbyoldbat · Sep 09, 2021 at 06:53 PM 0
Share

I didn't... I never got a reply an haven't figured it out myself either...

avatar image Jojoanse scabbyoldbat · Sep 11, 2021 at 04:44 PM 0
Share

Hello, the application is in the store? Have you created the ad unit for the rewarded video? I see that in the code you are using a test ad code.

avatar image scabbyoldbat Jojoanse · Sep 18, 2021 at 07:00 PM 0
Share

Hi, I did create an ad unit, in the code, there is a line that is commented out, which contained my code for the ad. The game is no longer in the store, I kept getting messages about "inten redirection" or something, and a deadline to fix it. But I couldn't get rid of those messages either

avatar image Miryum · Sep 13, 2021 at 06:23 PM 0
Share

I got the same problem, I will try solve and let you know

avatar image Jojoanse Miryum · Sep 15, 2021 at 04:39 PM 0
Share

In my case I just launch the game to the store and the ads works!

avatar image Miryum Jojoanse · Sep 15, 2021 at 05:09 PM 0
Share

Yes that's right but we are talking about test ads they don't show up. After I tried every possible solution, I ended up learning that even test ads don' show up if your admob account's ad serving is limited, I checked that by making a new project test ads were working fine, then I changed its packagename (game A) same as a game already published test ads did not show up. And this (game A) surprised me today by showing impressions after 56k requests over one week which means the implementation is fine, even though test ads did not show up during tests. I think something is wrong from Admob's part not the implementation, just make sure your build environement is fine and test with empty project.

Show more comments
avatar image
0

Answer by MarkMaa · Sep 11, 2021 at 05:19 PM

  1. Try to add test device via: List deviceIds = new List{ "YourTestDevice From Debug Logs" }; RequestConfiguration requestConfiguration = new RequestConfiguration .Builder() .SetTestDeviceIds(deviceIds) .build();

  2. Set up your Google Mobile Ads Settings for iOS

  3. Check your logs when you click the AD button

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MarkMaa · Sep 11, 2021 at 05:22 PM 0
Share

And try to add Debug.Log("") as log points to check where does your code stops working. MobileAds.Initialize(initStatus => { Debug.Log("[TestAd] " + initStatus}); is recommended

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

267 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Advert wont play 0 Answers

Adding features, eg online multiplayer android/ios 1 Answer

How to add advertisments to unity 3d games (android) 0 Answers

Mobile Ads Frameworks that support unity 0 Answers

Unity Admob glitching game screen 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges