Search Unity

[Android] No Unity ads on tablet

Discussion in 'Unity Ads & User Acquisition' started by lastshipsails, Feb 26, 2020.

  1. lastshipsails

    lastshipsails

    Joined:
    Jun 6, 2019
    Posts:
    5
    According doc:

    Important! The Banner class is part of the Advertisements API. When using banner ads in conjunction with the Monetization API (see section on Integration for Personalized Placements, below), you must initialize the Monetization SDK before accessing any classes or members of the Advertisements API. Accessing the Advertisements API prior to initializing the Monetization SDK will cause content retrieval to fail.

    Code (CSharp):
    1. using System.Collections;
    2. using UnityEngine.Monetization;
    3. using UnityEngine;
    4. using UnityEngine.Advertisements;
    5.  
    6. public class Banner : MonoBehaviour
    7. {
    8.     public string gameId = "3408987";
    9.     public string placementId = "banner";
    10.     public bool testMode = false;
    11.  
    12.     void Start()
    13.     {    
    14.         Monetization.Initialize(gameId, testMode);
    15.         Advertisement.Initialize(gameId, testMode);
    16.         StartCoroutine(ShowBannerWhenReady());
    17.     }
    18.  
    19.     IEnumerator ShowBannerWhenReady()
    20.     {
    21.         while (!Advertisement.IsReady(placementId))
    22.         {
    23.             yield return new WaitForSeconds(0.5f);
    24.         }
    25.         Advertisement.Banner.SetPosition(BannerPosition.TOP_CENTER);
    26.         Advertisement.Banner.Show(placementId);
    27.     }
    28. }
    On phone all right.
    On tablet - no ads.
    What is wrong?
    This app.
     
    Last edited: Feb 26, 2020
  2. TheFellhuhn

    TheFellhuhn

    Joined:
    Feb 3, 2017
    Posts:
    42
    Ahem, as a sidenote, you should have replaced Company and ProductName by your company and product name in your app's package name...
     
  3. lastshipsails

    lastshipsails

    Joined:
    Jun 6, 2019
    Posts:
    5
    I know it. I couldn't because need to create the new app in google console. To tired for this. Is it critical?