Search Unity

IUnityAdsListener Is not getting callbacks

Discussion in 'Unity Ads & User Acquisition' started by kutanarcanakgul, Dec 15, 2019.

Thread Status:
Not open for further replies.
  1. kutanarcanakgul

    kutanarcanakgul

    Joined:
    Aug 6, 2018
    Posts:
    11
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3. using UnityEngine.Advertisements;
    4. [RequireComponent(typeof(Button))]
    5. public class UnityAdsController : MonoBehaviour,IUnityAdsListener
    6. {
    7. #if UNITY_IOS
    8.     private string gameId = "1111111";
    9. #elif UNITY_ANDROID
    10.     private string gameId = "1111111";
    11. #endif
    12.  
    13.     Button myButton;
    14.     public string myPlacementId = "rewardedVideo";
    15.     void Start()
    16.     {
    17.         myButton = GetComponent<Button>();
    18.         // Set interactivity to be dependent on the Placement’s status:
    19.         // myButton.interactable = Advertisement.IsReady(myPlacementId);
    20.  
    21.         // Map the ShowRewardedVideo function to the button’s click listener:
    22.         if (myButton) myButton.onClick.AddListener(ShowRewardedVideo);
    23.      
    24.         // Initialize the Ads listener and service:
    25.         Advertisement.AddListener(this);
    26.         Advertisement.Initialize(gameId, true);
    27.  
    28.     }
    29.  
    30.     // Implement a function for showing a rewarded video ad:
    31.     void ShowRewardedVideo()
    32.     {
    33.         Advertisement.Show(myPlacementId);
    34.     }
    35.  
    36.  
    37. // Implement IUnityAdsListener interface methods:
    38. public void OnUnityAdsReady(string placementId)
    39.     {
    40.         // If the ready Placement is rewarded, activate the button:
    41.         if (placementId == myPlacementId)
    42.         {
    43.             myButton.interactable = true;
    44.         }
    45.         Debug.Log("INITIALIZED");
    46.     }
    47.     public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
    48.     {
    49.         // Define conditional logic for each ad completion status:
    50.         if (showResult == ShowResult.Finished)
    51.         {
    52.             Debug.LogWarning("Finished");
    53.         }
    54.         else if (showResult == ShowResult.Skipped)
    55.         {
    56.             // Do not reward the user for skipping the ad.
    57.         }
    58.         else if (showResult == ShowResult.Failed)
    59.         {
    60.             Debug.LogWarning("");
    61.         }
    62.     }
    63.  
    64.     public void OnUnityAdsDidError(string message)
    65.     {
    66.         // Log the error.
    67.     }
    68.  
    69.     public void OnUnityAdsDidStart(string placementId)
    70.     {
    71.         // Optional actions to take when the end-users triggers an ad.
    72.     }
    73. }
    74.  
    I'm using this code. I can see the ads but i cannot get any Callbacks. Am I doing something wrong here? Or IUnityAdsListener is not working?
     
    mahmoud93p likes this.
  2. mahmoud93p

    mahmoud93p

    Joined:
    Feb 11, 2015
    Posts:
    66
    Exactly like me, but sometimes is work in editor!
    What i tried
    Platform : Android 6 and above & IOS 12 & above

    1 -Install Unity Ads from assetstore store Or from package manger in unity 2019.2 is work
    but in unity 2018 sometimes is work in editor not mobile

    2- Turn off Ads service is not helpful "enable built in etc".

    I don't know what is problem my code exactly like "
    Rewarded video ad buttons
    " https://unityads.unity3d.com/help/unity/integration-guide-unity


    Logcat
    Code (JavaScript):
    1. 12-15 21:53:27.479 31365-31374/? I/art: Background sticky concurrent mark sweep GC freed 292956(14MB) AllocSpace objects, 11(276KB) LOS objects, 32% free, 31MB/46MB, paused 5.045ms total 189.514ms
    2. 12-15 21:53:29.730 1186-1227/? I/UnityAds: com.unity3d.services.ads.UnityAdsImplementation.show() (line:6) :: Unity Ads opening new ad unit for placement VDREWARDEDV3
    3. 12-15 21:53:29.778 1186-1471/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Opening performance ad unit with orientation PORTRAIT, hardware acceleration enabled
    4.  
    5.     --------- beginning of system
    6. 12-15 21:53:29.796 781-1894/? I/ActivityManager: START u0 {flg=0x10010000 cmp=com.abualamrin.humantest/com.unity3d.services.ads.adunit.AdUnitActivity (has extras)} from uid 10333 on display 0
    7. 12-15 21:53:29.906 781-799/? I/ActivityManager: Displayed com.abualamrin.humantest/com.unity3d.services.ads.adunit.AdUnitActivity: +90ms
    8. 12-15 21:53:29.907 1618-1618/? I/Keyboard.Facilitator: onFinishInput()
    9. 12-15 21:53:29.925 781-1669/? I/MediaFocusControl:  AudioFocus  requestAudioFocus() from android.media.AudioManager@43a0dc req=1flags=0x0
    10. 12-15 21:53:29.929 201-2425/? D/NuPlayer: onSetVideoSurface(0xb4845f00, no video decoder)
    11. 12-15 21:53:29.969 201-2425/? D/NuPlayerDriver: notifyListener_l(0xb28e0660), (5, 320, 180)
    12. 12-15 21:53:29.970 201-2425/? D/NuPlayerDriver: notifyListener_l(0xb28e0660), (1, 0, 0)
    13. 12-15 21:53:29.993 1186-1186/? D/MediaPlayer: getMetadata
    14. 12-15 21:53:30.014 201-26475/? D/NuPlayerDriver: start(0xb28e0660), state is 4, eos is 0
    15. 12-15 21:53:30.014 201-2425/? I/GenericSource: start
    16. 12-15 21:53:30.102 201-2441/? I/OMX-VDEC-1080P: component_init: OMX.qcom.video.decoder.avc : fd=19
    17. 12-15 21:53:30.103 201-2441/? I/OMX-VDEC-1080P: Capabilities: driver_name = msm_vidc_driver, card = msm_vdec_8974, bus_info = , version = 1, capabilities = 4003000
    18. 12-15 21:53:30.109 201-2441/? I/OMX-VDEC-1080P: omx_vdec::component_init() success : fd=19
    19. 12-15 21:53:30.111 201-2438/? I/MediaCodec: [OMX.qcom.video.decoder.avc] setting surface generation to 205839
    20. 12-15 21:53:30.112 201-2441/? E/OMX-VDEC-1080P: Extension: OMX.google.android.index.storeANWBufferInMetadata not implemented
    21. 12-15 21:53:30.113 201-2440/? E/OMXNodeInstance: setConfig(61:google.aac.decoder, ConfigPriority(0x6f800002)) ERROR: Undefined(0x80001001)
    22. 12-15 21:53:30.113 201-2440/? I/ACodec: codec does not support config priority (err -2147483648)
    23. 12-15 21:53:30.113 201-2440/? I/MediaCodec: MediaCodec will operate in async mode
    24. 12-15 21:53:30.116 201-2453/? I/SoftAAC2: Reconfiguring decoder: 0->44100 Hz, 0->2 channels
    25. 12-15 21:53:30.117 201-2438/? I/MediaCodec: MediaCodec will operate in async mode
    26. 12-15 21:53:30.136 201-2441/? D/SurfaceUtils: set up nativeWindow 0xb4845f08 for 320x180, color 0x7fa30c04, rotation 0, usage 0x42002900
    27. 12-15 21:53:30.147 201-814/? D/audio_hw_primary: out_set_parameters: enter: usecase(1: low-latency-playback) kvpairs: routing=2
    28. 12-15 21:53:30.148 201-2425/? D/NuPlayerDriver: notifyListener_l(0xb28e0660), (6, 0, 0)
    29. 12-15 21:53:30.154 201-2441/? D/SurfaceUtils: set up nativeWindow 0xb4845f08 for 320x192, color 0x7fa30c04, rotation 0, usage 0x42002900
    30. 12-15 21:53:30.155 31399-24752/? I/Checkin: [EventLogChimeraService] Opted in for usage reporting: true
    31. 12-15 21:53:30.155 31399-24752/? I/Checkin: [EventLogChimeraService] Aggregate from 1576437231608 (log), 1576437231608 (data)
    32. 12-15 21:53:30.168 201-2425/? D/NuPlayerDriver: notifyListener_l(0xb28e0660), (5, 320, 180)
    33. 12-15 21:53:30.168 201-2425/? D/NuPlayerDriver: notifyListener_l(0xb28e0660), (200, 3, 0)
    34. 12-15 21:53:30.168 1186-1203/? W/MediaPlayer: info/warning (3, 0)
    35. 12-15 21:53:30.222 201-814/? D/AudioFlinger: mixer(0xb4100000) throttle end: throttle time(11)
    36. 12-15 21:53:30.310 1186-1471/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Unity Ads event: sending start event to https://impact.applifier.com/events/v2/video/video_start/1773727/000000000000000000000000
    37. 12-15 21:53:30.352 781-1686/? W/DropBoxManagerService: Dropping: event_log (61 > 0 bytes)
    38. 12-15 21:53:30.358 781-1669/? W/DropBoxManagerService: Dropping: event_data (39 > 0 bytes)
    39. 12-15 21:53:30.370 31399-24752/? I/Checkin: [ServiceDumpSys] dumping service [account]
    40. 12-15 21:53:30.380 781-1670/? W/DropBoxManagerService: Dropping: dumpsys:account (234 > 0 bytes)
    41. 12-15 21:53:30.612 31365-31365/? W/ChimeraUtils: Non Chimera context
    42. 12-15 21:53:30.634 31365-2462/? I/aokb: Removed 0 invalid users [CONTEXT service_id=51 ]
    43. 12-15 21:53:30.964 31365-2462/? W/Conscrypt: Could not set socket write timeout: java.net.SocketException: Socket closed
    44. 12-15 21:53:30.974 31365-2462/? W/Conscrypt:     at com.google.android.gms.org.conscrypt.Platform.setSocketWriteTimeout(:com.google.android.gms@19831018@19.8.31 (040308-284611645):2)
    45. 12-15 21:53:30.974 31365-2462/? W/Conscrypt:     at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.setSoWriteTimeout(:com.google.android.gms@19831018@19.8.31 (040308-284611645):2)
    46. 12-15 21:53:31.080 781-1669/? W/DropBoxManagerService: Dropping: exp_det_cert_pin_failure (10 > 0 bytes)
    47. 12-15 21:53:31.138 31365-2462/? W/Conscrypt: Could not set socket write timeout: java.net.SocketException: Socket closed
    48. 12-15 21:53:31.138 31365-2462/? W/Conscrypt:     at com.google.android.gms.org.conscrypt.Platform.setSocketWriteTimeout(:com.google.android.gms@19831018@19.8.31 (040308-284611645):2)
    49. 12-15 21:53:31.138 31365-2462/? W/Conscrypt:     at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.setSoWriteTimeout(:com.google.android.gms@19831018@19.8.31 (040308-284611645):2)
    50. 12-15 21:53:32.171 31365-2462/? I/aojp: Scheduling adaptive one off task with window [14400, 604800] in seconds [CONTEXT service_id=51 ]
    51. 12-15 21:53:32.296 1186-1471/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Unity Ads event: sending first_quartile event to https://impact.applifier.com/events/v2/video/first_quartile/1773727/000000000000000000000000
    52. 12-15 21:53:34.602 1186-1471/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Unity Ads event: sending midpoint event to https://impact.applifier.com/events/v2/video/midpoint/1773727/000000000000000000000000
    53. 12-15 21:53:35.847 1186-1471/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Requesting ad plan from https://auction.unityads.unity3d.com/v4/test/games/1773727/requests?advertisingTrackingId=3a249062-21fc-49bb-93dd-df25f2b2584d&limitAdTracking=true&deviceModel=Nexus%205&platform=android&sdkVersion=3400&stores=google&deviceMake=LGE&screenSize=268435794&screenDensity=480&apiLevel=23&test=true&screenWidth=1080&screenHeight=1776&connectionType=wifi&networkType=0
    54. 12-15 21:53:36.557 1186-1471/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Unity Ads event: sending third_quartile event to https://impact.applifier.com/events/v2/video/third_quartile/1773727/000000000000000000000000
    55. 12-15 21:53:36.773 1186-1471/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: AdPlan received with 1 campaigns and refreshDelay 0
    56. 12-15 21:53:38.005 201-2439/? I/NuPlayerDecoder: [audio] saw output EOS
    57. 12-15 21:53:38.304 201-2437/? I/NuPlayerDecoder: [video] saw output EOS
    58. 12-15 21:53:38.485 201-2425/? D/NuPlayerDriver: notifyListener_l(0xb28e0660), (2, 0, 0)
    59. 12-15 21:53:38.516 201-1041/? D/NuPlayerDriver: stop(0xb28e0660)
    60. 12-15 21:53:38.516 201-1041/? D/NuPlayerDriver: notifyListener_l(0xb28e0660), (8, 0, 0)
    61. 12-15 21:53:38.517 201-1040/? D/NuPlayerDriver: reset(0xb28e0660)
    62. 12-15 21:53:38.521 201-2425/? W/AMessage: failed to post message as target looper for handler 0 is gone.
    63. 12-15 21:53:38.540 201-2441/? I/OMX-VDEC-1080P: omx_vdec::component_deinit() complete
    64. 12-15 21:53:38.564 201-2441/? I/OMX-VDEC-1080P: Exit OMX vdec Destructor: fd=19
    65. 12-15 21:53:38.567 201-2425/? W/AMessage: failed to post message as target looper for handler 0 is gone.
    66. 12-15 21:53:38.569 201-2425/? D/NuPlayerDriver: notifyResetComplete(0xb28e0660)
    67. 12-15 21:53:38.571 781-1893/? I/MediaFocusControl:  AudioFocus  abandonAudioFocus() from android.media.AudioManager@43a0dc
    68. 12-15 21:53:38.579 1186-1471/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Unity Ads event: sending view event to https://impact.applifier.com/events/v2/video/video_end/1773727/000000000000000000000000
    69. 12-15 21:53:38.586 1186-1186/? W/MediaPlayer: mediaplayer went away with unhandled events
    70. 12-15 21:53:38.595 1618-1618/? I/Keyboard.Facilitator: onFinishInput()
    71. 12-15 21:53:39.551 1186-1186/? I/chromium: [INFO:CONSOLE(22848)] "Uncaught (in promise) Experiment session not started.", source: file:///storage/emulated/0/Android/data/com.abualamrin.humantest/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fwebview.unityads.unity3d.com%2Fwebview%2F3.4.0%2F78d2436ae72e107aef173839f2d1c75b335ae789%2Frelease%2Findex.html&version=78d2436ae72e107aef173839f2d1c75b335ae789 (22848)
    72. 12-15 21:53:39.607 1186-1471/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Closing Unity Ads ad unit
    73. 12-15 21:53:39.669 1618-1618/? I/Keyboard.Facilitator: onFinishInput()
    74. 12-15 21:53:39.748 201-814/? D/audio_hw_primary: out_set_parameters: enter: usecase(1: low-latency-playback) kvpairs: routing=2
    75. 12-15 21:53:39.781 201-814/? D/AudioFlinger: mixer(0xb4100000) throttle end: throttle time(7)
    76. 12-15 21:53:40.485 211-294/? I/ThermalEngine: TM Id 'SKIN_THERMAL_management_1' Sensor 'xo_therm_pu2' - alarm raised 2 at 42.0 degC
    77. 12-15 21:53:40.485 211-294/? I/ThermalEngine: ACTION: CPU - Setting CPU[0] to 1574400
    78. 12-15 21:53:40.485 211-294/? I/ThermalEngine: ACTION: CPU - Setting CPU[1] to 1574400
    79. 12-15 21:53:40.485 211-294/? I/ThermalEngine: ACTION: CPU - Setting CPU[2] to 1574400
    80. 12-15 21:53:40.485 211-294/? I/ThermalEngine: ACTION: CPU - Setting CPU[3] to 1574400
    81. 12-15 21:53:40.486 211-294/? I/ThermalEngine: ACTION: LCD - Setting max LCD brightness to 204
    82. 12-15 21:53:40.486 211-294/? I/ThermalEngine: Setting curr LCD brightness to 255
    83.  
     
  3. mahmoud93p

    mahmoud93p

    Joined:
    Feb 11, 2015
    Posts:
    66

    Man this code is work but in editor say "[deprecated] class UnityEngine.Monetization.Monetization"
    Look if this work does matter, when unity team make good update for Ads and unity 2019 without pink screen and fix 2018 we make update for those libraries.
    Note: This code not from me this code from https://unityads.unity3d.com/help/unity/integration-guide-unity

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3. using UnityEngine.Monetization;
    4.  
    5. [RequireComponent (typeof (Button))]
    6. public class UnityAdsButton : MonoBehaviour {
    7.  
    8.     public string placementId = "rewardedVideo";
    9.     private Button adButton;
    10.  
    11. #if UNITY_IOS
    12.    private string gameId = "111111";
    13. #elif UNITY_ANDROID
    14.     private string gameId = "11111";
    15. #endif
    16.  
    17.     void Start () {
    18.         adButton = GetComponent<Button> ();
    19.         if (adButton) {
    20.             adButton.onClick.AddListener (ShowAd);
    21.         }
    22.  
    23.         if (Monetization.isSupported) {
    24.             Monetization.Initialize (gameId, true);
    25.         }
    26.     }
    27.  
    28.     void Update () {
    29.         if (adButton) {
    30.             adButton.interactable = Monetization.IsReady (placementId);
    31.         }
    32.     }
    33.  
    34.     void ShowAd () {
    35.         ShowAdCallbacks options = new ShowAdCallbacks ();
    36.         options.finishCallback = HandleShowResult;
    37.         ShowAdPlacementContent ad = Monetization.GetPlacementContent (placementId) as ShowAdPlacementContent;
    38.         ad.Show (options);
    39.     }
    40.  
    41.     void HandleShowResult (ShowResult result) {
    42.         if (result == ShowResult.Finished) {
    43.             // Reward the player
    44.         } else if (result == ShowResult.Skipped) {
    45.             Debug.LogWarning ("The player skipped the video - DO NOT REWARD!");
    46.         } else if (result == ShowResult.Failed) {
    47.             Debug.LogError ("Video failed to show");
    48.         }
    49.     }
    50. }
     
    Last edited: Dec 15, 2019
  4. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    Hi,

    Thanks for reporting. I checked with the team, and unfortunately there is an issue with SDK 3.4 on Android:

     
    juissi and bakir-omarov like this.
  5. bakir-omarov

    bakir-omarov

    Joined:
    Aug 1, 2015
    Posts:
    48
    I also confirm this bug.
    It works only once in the Editor, and then Listener stops getting info. But if you close Unity, and reopen it, then it will work again, but of course only in first Play session.
    In android devices, it doesn't work even for the first time.
    Unity 2018.3.4f1 , Android Platform, Unity Monetization v3.4.0 (downloaded from asset store)

    Can you share SDK 3.3.0 (unitypackage)? I can't find any link to it.
     
  6. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    I verified with Unity 2018.4.14f1, that you can use Package Manager window to use a previous version of Ads SDK
    upload_2019-12-16_12-18-31.png

    Would that work for you?
     
  7. bakir-omarov

    bakir-omarov

    Joined:
    Aug 1, 2015
    Posts:
    48
    Yeap, I forgot about Package Manager, thanks)

    I have 2 questions:
    1) Is the 3.3.1 works correct? Or it is better to install 3.3.0?

    2) What is the most correct way to remove 3.4?
    Will just deleting the folder "UnityAds" and then adding 3.3 from Package Manager lead to some bugs?
    Or do I have to find and delete all the files from these folders one by one too?
    Editor-Resources
    Plugins-Android-iOS
     
  8. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    I believe 3.3.1 should work. I haven't had time to try myself, but as far as I know issue exists only in 3.4.0

    If you have installed from Asset Store, you should also remove UnityAds files under Plugins folder as well.

    /Rasmus
     
    bakir-omarov likes this.
  9. bartofzo

    bartofzo

    Joined:
    Mar 16, 2017
    Posts:
    151
    Having the same problem but using Unity Ads from the asset store. Should I use the version from the package manager?

    I can only see versions 2.0.8 and 3.4.1 there. Does 3.4.1 have the fix?
     
  10. jinming_cao

    jinming_cao

    Joined:
    Oct 2, 2019
    Posts:
    17
    3.4.1 is even worse. you don't get any events triggered even in editor
     
  11. bartofzo

    bartofzo

    Joined:
    Mar 16, 2017
    Posts:
    151
    ...OK so is there a solution?
     
  12. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @bartofzo
    Thanks for reporting this issue. We'll need some more information:

    Which version of Unity are you using?
    Can you provide the script you are using to test the callbacks?
    Can you provide the manifest.json file in your Packages folder?
     
  13. bakir-omarov

    bakir-omarov

    Joined:
    Aug 1, 2015
    Posts:
    48
    Did you click on "All Versions" ?

    Unity 2019.*


    Unity 2018.*
     
    Last edited: Dec 18, 2019
  14. bartofzo

    bartofzo

    Joined:
    Mar 16, 2017
    Posts:
    151
    2019.2.16f1

    I was using the version from the asset store so I can't find a manifest.json

    Regarding the script, it is almost exactly the same as the example in the documentation. And I have confirmed it works on an iOS build, so I'm assuming my code is correct.
     
  15. bartofzo

    bartofzo

    Joined:
    Mar 16, 2017
    Posts:
    151
    No I didn't. Thanks! I'll try this out later today.
     
  16. sbankhead

    sbankhead

    Unity Technologies

    Joined:
    Jul 27, 2014
    Posts:
    97
    @bartofzo It sounds like your having an issue with callbacks on device. Please note that in 3.4.0 we had an issue with callbacks on android devices and this was fixed in 3.4.1. You will find this new version on the asset store and in package manager. If you are still having issues after updating to 3.4.1 please start a new issue with your specific details including a repro script/project if possible. Thanks
     
  17. banjen

    banjen

    Joined:
    Oct 9, 2019
    Posts:
    3
    Same issue, Unity 2019.2.14f1. Started on ads 3.4.1 and tried 3.4.0, 3.3.1, 3.3.0. All no callbacks being fired. Ads work in other methods but the callbacks are just not being fired. Is there any special cache folders that need to be deleted to make downgrading work?
     
    XSPR likes this.
  18. jacobfdunbar

    jacobfdunbar

    Joined:
    Jun 25, 2015
    Posts:
    16
    Was able to fix this by upgrading to Ads 3.4.2 (from 3.4.0) and my project to Unity 2019.3.0f6 (from 2019.2.3). Just upgrading to 3.4.2 didn't do it: I had to upgrade the project as well. Perhaps anecdotal, but hopefully helps others out.
     
  19. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
    Any news on this?

    >> Unity 2020.1.0a24

    Same problem here.
    Below log from android device connected to the Unity Console.
    Got not callback from listeners at all.
    Screen Shot 2020-02-28 at 22.48.51.png Screen Shot 2020-02-28 at 22.49.04.png
     
  20. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
    Also double checking the documentation to see if any update and from the Testing section, somethings goes wrong :

    I click on the Developer Dashboard blue link, then Settings, but no Project Settings there.
    It's because I remember playing with it the last month and there was the TestMode switch as mentioned...

    Wrong URL from the doc? Something wrong on your side?

    EDIT :

    Alright documentation should be :
    2. Select Projects to access to the Project List view : Select your project.
    3. Select Settings > Project Settings from the left navigation bar.
    etc....

    Screen Shot 2020-02-28 at 23.16.39.png Screen Shot 2020-02-28 at 23.15.42.png
     
    Last edited: Feb 28, 2020
  21. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
    Alright then after making a new project and starting from scratch, I found that I was using the enablePerPlacementLoad flag from the Advertisement.Initialize().
    I have no idea when or why I was using it, maybe from some old documentation...o_O
    Reviewed one more time this page : https://unityads.unity3d.com/help/unity/integration-guide-unity
    And it doesn't even mentions about it all anymore...

    Anyway then something like this :
    Code (CSharp):
    1. Advertisement.Initialize("myID", true, true);
    ...will simply disable every callback from the listener.
     
  22. escon1004

    escon1004

    Joined:
    Apr 15, 2020
    Posts:
    9
    with Unity Ads 3.4.6 and 3.4.7, the IUnityAdsListener still is not working :(

    you guys really sure that you already fixed it with 3.4.2 version?????????????????????
     
  23. doarp

    doarp

    Joined:
    Sep 24, 2019
    Posts:
    147
    having the same issue with 3.4.7, Unity 2019.4.1f, on iOS with AdMob also initialized.
    With AdMob not initialized callbacks work and on Android callbacks work, but iOS with AdMob they don't.
     
  24. Ersin

    Ersin

    Joined:
    Oct 25, 2012
    Posts:
    13
    Same problem. IUnityAdsListener still is not working.
    Unity Ads : v3.4.7
    Unity : 2018.4.24f1
     
  25. kaskill

    kaskill

    Joined:
    Aug 23, 2020
    Posts:
    2
    Advertisement.AddListener(this);
    (Error CS1503 Argument 1: Cannot convert from "MyScript" to "UnityEngine.Advertisements.IUnityAdsListener".)
    Unity Ads : v3.4.9
    Unity : 2019.2.15f1
     
  26. kaskill

    kaskill

    Joined:
    Aug 23, 2020
    Posts:
    2
    I found the error, need to add an interface:
    public class MyScript : MonoBehaviour, IUnityAdsListener
    {...
     
  27. adamcheong

    adamcheong

    Joined:
    Mar 30, 2020
    Posts:
    6
    Unity 2020.1.3f1
    Unit Ads 3.4.9

    I have implemented IUnityAdsListener code - is almost identical to sample code?

    Callbacks not firing in editor or on device.(android)

    UPDATE:

    ok i was just being an idiot and forgot to add:
    Advertisement.AddListener (this);

    because for some reason i assumed implementing the interface would subscribe to callbacks implicitly.
     
    Last edited: Aug 25, 2020
    Bambusz and Amit_Patel like this.
  28. DharmendraKumar_Jagodana

    DharmendraKumar_Jagodana

    Joined:
    Feb 2, 2020
    Posts:
    4
    I m getting error after Unity rewardvideo completion and also the rewardvideo complete callback is not called.
    Using Unity-2019.4.10f1 and package for Advertisement is 3.4.9.

    Error :

    UnityException: Find can only be called from the main thread.
    Constructors and field initializers will be executed from the loading thread when loading a scene.
    Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
    at UnityEngine.Advertisements.Utilities.UnityLifecycleManager.Initialize () [0x00000] in <00000000000000000000000000000000>:0
    at UnityEngine.Advertisements.Utilities.UnityLifecycleManager.Post (System.Action action) [0x00000] in <00000000000000000000000000000000>:0
    at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <00000000000000000000000000000000>:0
    at UnityEngine.AndroidJavaProxy.Invoke (System.String methodName, System.Object[] args) [0x00000] in <00000000000000000000000000000000>:0
    at UnityEngine._AndroidJNIHelper.InvokeJavaProxyMethod (UnityEngine.AndroidJavaProxy proxy, System.IntPtr jmethodName, System.IntPtr jargs) [0x00000] in <00000000000000000000000000000000>:0
    Rethrow as TargetInvocationException: UnityEngine.Advertisements.Platform.Android.AndroidPlatform.onUnityAdsReady(System.String)
    at UnityEngine.AndroidJavaProxy.Invoke (System.String methodName, System.Object[] args) [0x00000] in <00000000000000000000000000000000>:0
    at UnityEngine._AndroidJNIHelper.InvokeJavaProxyMethod (UnityEngine.AndroidJavaProxy proxy, System.IntPtr jmethodName, System.IntPtr jargs) [0x00000] in <00000000000000000000000000000000>:0

    (Filename: currently not available on il2cpp Line: -1)


    problem: Rewardvideo/Interstitial result is not coming. so i am unable to give rewards to user or hide some object on screen.

    NOTE :
    i already submitted 2 or more version with unity ads. but at this time i added other monetization like Ironsource. then this error started.

    - Both package for advertisement and UnityEditor version are same as previous successful build.
     
  29. DharmendraKumar_Jagodana

    DharmendraKumar_Jagodana

    Joined:
    Feb 2, 2020
    Posts:
    4
    - I am using Services window to add advertisement package and I have tried many time by remove and add package again but nothing happened.
     
  30. DharmendraKumar_Jagodana

    DharmendraKumar_Jagodana

    Joined:
    Feb 2, 2020
    Posts:
    4

    Code (CSharp):
    1.  
    2. public class UnityAdsManager : Singleton<UnityAdsManager>, IUnityAdsListener
    3.     {
    4.         private void Start()
    5.         {
    6.             Initialize();
    7.         }
    8.  
    9.         public void Initialize()
    10.         {
    11.             MyLogger.Log(this, "Initialize Called...");
    12.             string GameID = "12123132";
    13.  
    14.             Advertisement.AddListener(this);
    15.             Advertisement.Initialize(GameID, ApplicationDataHelper.IsDebugMode);
    16.             Advertisement.debugMode = ApplicationDataHelper.IsDebugMode;
    17.         }
    18. }
     
  31. Bambusz

    Bambusz

    Joined:
    Jan 8, 2021
    Posts:
    6
    My friend you are a life saver THANK YOU, your comment is the ONLY documentation, where this line of code exists, thank you!
     
  32. JamesBear

    JamesBear

    Joined:
    Sep 27, 2017
    Posts:
    1
    Seems that creating a static ads listener may help. It's just my experience.
     
Thread Status:
Not open for further replies.