Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

AdMob in android phone not show

Discussion in 'Unity Ads & User Acquisition' started by aryiaDehbozorgi, Feb 8, 2021.

  1. aryiaDehbozorgi

    aryiaDehbozorgi

    Joined:
    Jan 7, 2021
    Posts:
    6
    hi

    i do get app id and unit id for admob from google admob
    then install and config admob in my unity project
    and in unity editor worked and show Ads Test Page
    but after make apk and install on android phone not worked
    no display ad or crash or error ........
    please help me !!!!!!!

    thanks for all

    i do for show ad call adshow() in button click

    my cod is :
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using System;
    5. using UnityEngine.UI;
    6. using GoogleMobileAds.Api;
    7. public class ads : MonoBehaviour
    8. {
    9.     private InterstitialAd interstitial;
    10.  
    11.     private void RequestInterstitial()
    12.     {
    13.          string adUnitId = "ca-app-pub-MyCode";
    14.  
    15.         // Initialize an InterstitialAd.
    16.         this.interstitial = new InterstitialAd(adUnitId);
    17.  
    18.         // Called when an ad request has successfully loaded.
    19.         this.interstitial.OnAdLoaded += HandleOnAdLoaded;
    20.         // Called when an ad request failed to load.
    21.         this.interstitial.OnAdFailedToLoad += HandleOnAdFailedToLoad;
    22.         // Called when an ad is shown.
    23.         this.interstitial.OnAdOpening += HandleOnAdOpened;
    24.         // Called when the ad is closed.
    25.         this.interstitial.OnAdClosed += HandleOnAdClosed;
    26.         // Called when the ad click caused the user to leave the application.
    27.         this.interstitial.OnAdLeavingApplication += HandleOnAdLeavingApplication;
    28.  
    29.         // Create an empty ad request.
    30.         AdRequest request = new AdRequest.Builder().Build();
    31.         // Load the interstitial with the request.
    32.         this.interstitial.LoadAd(request);
    33.     }
    34.  
    35.     public void HandleOnAdLoaded(object sender, EventArgs args)
    36.     {
    37.         MonoBehaviour.print("HandleAdLoaded event received");
    38.     }
    39.  
    40.     public void HandleOnAdFailedToLoad(object sender, AdFailedToLoadEventArgs args)
    41.     {
    42.         MonoBehaviour.print("HandleFailedToReceiveAd event received with message: "
    43.                             + args.Message);
    44.     }
    45.  
    46.     public void HandleOnAdOpened(object sender, EventArgs args)
    47.     {
    48.         MonoBehaviour.print("HandleAdOpened event received");
    49.     }
    50.  
    51.     public void HandleOnAdClosed(object sender, EventArgs args)
    52.     {
    53.         MonoBehaviour.print("HandleAdClosed event received");
    54.     }
    55.  
    56.     public void HandleOnAdLeavingApplication(object sender, EventArgs args)
    57.     {
    58.         MonoBehaviour.print("HandleAdLeavingApplication event received");
    59.     }
    60.  
    61.  
    62.  
    63.     private void Start()
    64.     {
    65.         RequestInterstitial();
    66.     }
    67.  
    68.     public void adshow()
    69.     {
    70.         if (this.interstitial.IsLoaded())
    71.         {
    72.             this.interstitial.Show();
    73.         }
    74.     }
    75.  
    76. }
    77.  
     
  2. aryiaDehbozorgi

    aryiaDehbozorgi

    Joined:
    Jan 7, 2021
    Posts:
    6
    my ststus is :
    handle failed to receive an event receive massage : no fill
    plz help me !!!