Search Unity

Bug banner ad always displays top left on Android

Discussion in 'Unity Ads & User Acquisition' started by enhawk, Feb 20, 2023.

  1. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    I have the banner set to BannerPosition.BOTTOM_CENTER;

    Works fine on iOS and in the Unity Editor

    On Android it displays top left. Tested on various versions of android and devices, always comes in top left.

    Advertisment 4.3

    Screen Shot 2023-02-20 at 15.33.02.png
     
    Last edited: Feb 20, 2023
  2. Yasuyuki

    Yasuyuki

    Unity Technologies

    Joined:
    Sep 11, 2014
    Posts:
    153
    Could you attach your code snippet that shows the banner? I will try to reproduce it with your code.
     
  3. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    sure, it's the standard sample banner code.

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Advertisements;
    3.  
    4. public class BannerAd : MonoBehaviour
    5. {
    6.     [SerializeField] BannerPosition _bannerPosition = BannerPosition.BOTTOM_CENTER;
    7.  
    8.     [SerializeField] string _androidAdUnitId = "xxx";
    9.     [SerializeField] string _iOSAdUnitId = "xxx";
    10.     string _adUnitId = null; // This will remain null for unsupported platforms.
    11.  
    12.     void Start()
    13.     {
    14.         // Get the Ad Unit ID for the current platform:
    15.         _adUnitId = (Application.platform == RuntimePlatform.IPhonePlayer)
    16.             ? _iOSAdUnitId
    17.             : _androidAdUnitId;
    18.  
    19.         Advertisement.Banner.SetPosition(_bannerPosition);
    20.     }
     
  4. Yasuyuki

    Yasuyuki

    Unity Technologies

    Joined:
    Sep 11, 2014
    Posts:
    153
    How did you call Banner.Load() and Banner.Show()?
    Does Show() call after complete Load()?
    https://docs.unity.com/ads/en/manual/ImplementingBannerAdsUnity#Script_implementation
     
  5. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
  6. Yasuyuki

    Yasuyuki

    Unity Technologies

    Joined:
    Sep 11, 2014
    Posts:
    153
    Could you share your script file? I still can't understand how you implemented it.
     
    enhawk likes this.
  7. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
  8. pabloware

    pabloware

    Joined:
    Oct 22, 2020
    Posts:
    15
    Same issue here.
     
  9. Yasuyuki

    Yasuyuki

    Unity Technologies

    Joined:
    Sep 11, 2014
    Posts:
    153
    If you are using Unity Ads SDK 4.3, please try to update to the latest SDK.
    We've confirmed there's a banner bug on Android which is pretty similar to this thread. It should have been solved in 4.4.
     
  10. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    4.4 apps are rejected when submitting through xcode to the appstore.

    currently I am building with 4.3 for ios and 4.4 for android.
     
  11. Yasuyuki

    Yasuyuki

    Unity Technologies

    Joined:
    Sep 11, 2014
    Posts:
    153
    If you need to downgrade Ads SDK, please use 4.2.1 instead to avoid the banner position issue.

    I never heard of the rejection issue with Unity Ads SDK 4.4, at the moment, I don't think it was caused by Ads SDK. Could you email us the details and file a ticket for the rejection issue since getting off-topic?
    unityads-support@unity3d.com
     
  12. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    @Yasuyuki I’ll try 4.2, thanks!

    I tried in an empty project with unity ads 4.4 and get same error when submitting to the appstore through xcode. I’m happy to send the project over. Others are facing the same problem: https://forum.unity.com/threads/uni...-contains-disallowed-file-frameworks.1402861/
     
  13. Ebonicus

    Ebonicus

    Joined:
    Oct 31, 2016
    Posts:
    158

    I have the exact opposite, I build on PC, Android works find at bottom center.
    When I build iOS, it appears at Top Left.

    @hawken @Yasuyuki
    I am using Unity Ads 4.4.1, as far as getting the upload error, I resolved that. Today.

    Target Unity iPhone > Build Settings: Always Embed Swift Libraries : SET to YES
    Target Unity.Framework > Build Settings: Always Embed Swift Libraries : SET to NO

    Otherwise you get a duplicate set of swift libraries in your XCarchives located in:
    Programs>Appname>Frameworks>UnityFramework.Framework>Frameworks (swift libraries here cause the error)
     
  14. Ebonicus

    Ebonicus

    Joined:
    Oct 31, 2016
    Posts:
    158
    I am having the issue on 4.4, but on iOS is my error, android works fine and sets banner to Bottom Center.
    Do I need to downgrade to 4.2 ?
     
  15. Yasuyuki

    Yasuyuki

    Unity Technologies

    Joined:
    Sep 11, 2014
    Posts:
    153
    Please make sure if calling Banner.SetPosition() before Banner.Load(), otherwise I guess the banner will appear at the top left corner.
     
  16. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    this still happens.

    This caused me a lot of headache. We caught it in another thread in this forum. Pretty annoying that it needs to be set every time you build from Unity. I hope a fix for this appears soon
     
  17. Ebonicus

    Ebonicus

    Joined:
    Oct 31, 2016
    Posts:
    158
    Thanks that's a fix at least. Here is what we detected so far

    Latest IPad pro - appears on bottom center as assigned
    iphone latest appears on bottom center
    ipad mini - appears on bottom center
    ipad mini old, appears at top left
    Old ipad airs, appears at top left
    iphone 5,6 appears at top left

    So this seems to be an issue with older iphone OS's.