B4A Library Unity Ads Library

Original library: https://github.com/Unity-Technologies/unity-ads-android
Based on Unity Ads Library v4.4.1 (05 Oct 2022).
Banner, Interstitial and Rewarded Video.

v4.0.x - A lot of events, methods and classes are depecated or changed, full list here. If you use this library for the first time in your project, there is no problem for you. However, if you are upgrading the library from any of the previous versions, be warned that you will need to change your code. Example app is also updated for v4.0.



For InterstitialAd and for RewardedVideoAd you need to add this in your manifest:
B4X:
AddApplicationText(<activity
            android:name="com.unity3d.services.ads.adunit.AdUnitActivity"
            android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
            android:hardwareAccelerated="true" />

        <activity
            android:name="com.unity3d.services.ads.adunit.AdUnitTransparentActivity"
            android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
            android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
            android:hardwareAccelerated="true" />

        <activity
            android:name="com.unity3d.services.ads.adunit.AdUnitTransparentSoftwareActivity"
            android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
            android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
            android:hardwareAccelerated="false" />

        <activity
            android:name="com.unity3d.services.ads.adunit.AdUnitSoftwareActivity"
            android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
            android:hardwareAccelerated="false" />)

Download library from:
 

Attachments

  • UnityAdsExample.zip
    11.8 KB · Views: 151
Last edited:

Douglas Farias

Expert
Licensed User
Longtime User
Hi @Pendrush
First, Thank you for the lib, i m testing here.

one report...
the UnityAdsInterstitial.IsInitialized is always returning false.
the IsReady is true but the IsInitialized is false.

i have not tested banner, but i think it is with same problem.

thx
 

Douglas Farias

Expert
Licensed User
Longtime User
Hello @Pendrush
can you please update this lib to lasted version of unity sdk (3.7.5)? or upload the source code? thank you
 

Blueforcer

Well-Known Member
Licensed User
Longtime User
Is this still working?
B4X:
UnityAdsInterstitial.InitializeInterstitial("InterstitialAds", "4782531", False, "Interstitial_Android")
i always get
OnUnityAdsFailedToLoad: Error: INVALID_ARGUMENT, Error message: No placement configured for id: Interstitial_Android, PlacementId: Interstitial_Android

as placement ID i entered the ad-unit ID, since i dont find any PlacementId



is this correct?
 

Pendrush

Well-Known Member
Licensed User
Longtime User
Cookies are required to use this site. You must accept them to continue using the site. Learn more…