Admob shows in Editor, but not on a real Android device.

So, I implemented admob into my project, the problem is that in Editor it is showing perfectly, both test ad and real one. But after build on Android neither one works.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;
using GoogleMobileAds;


public class onClick : MonoBehaviour
{
    private RewardedAd rewardedAd;
    void Start() {
       
    }
    private void OnMouseDown()
    {
        this.rewardedAd = new RewardedAd("ca-app-pub-5346701446101044/4602400235");
        AdRequest request = new AdRequest.Builder().Build();
        this.rewardedAd.LoadAd(request);
        Debug.Log("Work");
    }
}

Sorry, guys, thats not the right code, sorry once again

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;
using GoogleMobileAds;
using GoogleMobileAds.Common;
using System;

public class ButtonClick : MonoBehaviour
{
    public RewardedAd rewardedAd;
    public GameObject obj;
    // Start is called before the first frame update
    public void Start()
    {
        MobileAds.Initialize(initStatus => { });
        this.rewardedAd = new RewardedAd("ca-app-pub-3940256099942544/5224354917");
        AdRequest request = new AdRequest.Builder().Build();
        this.rewardedAd.LoadAd(request);
        this.rewardedAd.OnUserEarnedReward += HandleUserEarnedReward;
        this.rewardedAd.OnAdClosed += HandleRewardedAdClosed;
        this.rewardedAd.OnAdFailedToShow += HandleRewardedAdFailedToShow;
    }
    public void ShowRewardVideo() {
        if (rewardedAd.IsLoaded())
        {
            rewardedAd.Show();
        }
    }
    public void HandleUserEarnedReward(object sender, Reward args)
    {
        int coins = PlayerPrefs.GetInt("kermamoneta");
        int adRew = coins + 15;
        PlayerPrefs.SetInt("kermamoneta", adRew);
    }
    public void HandleRewardedAdClosed(object sender, EventArgs args)
    {
        Destroy(obj);
    }
    public void HandleRewardedAdFailedToShow(object sender, AdErrorEventArgs args)
    {
        Destroy(obj);
    }
}

AdMob rewarded ads will show a test ad in editor but will not work in apk unless released through app store.

It does not need to be ‘published’, but it must be downloaded from apple/google.

For google play, use internal testing
For apple use test flight

1 Like

Big thanks, i hope it works!

Does this also work same for (banner , interstitial ads)??

yes

rewarded and banner ads are not showing while interstitial ad is working perfectly (on mobile device)