Search code examples
androidvungle-ads

how to know my vungle ad is completely seen by user or not?


I am using a vungle app-id in my app and I want to increment the wallet of the user, only if the video ad is completely seen by user.

//code in my Activity

  final VunglePub vunglePub = VunglePub.getInstance();
        final String app_id= "58d46c1feba9a90a1a000011"; //vungleid
        vunglePub.init(this,app_id);
        final EventListener vungleListener= new EventListener() { 
            @Override
            public void onAdEnd(boolean b, boolean b1) {
                Update();
            }
};

I am trying to update the wallet of user by calling Update method from onAdEnd method of listener but it updates the wallet even if the user closes the ad.

I am trying vungle for the first time, also searched a lot but didnt got my answer. Any help regarding this is appreciated. Thanks!..


Solution

  • I am Gabor, working as Intergation Engineer @Vungle.

    You can check our documentation here to see how you can use the event listeners. https://support.vungle.com/hc/en-us/articles/204463100-Advanced-Settings-for-Vungle-Android-SDK

    The above recommended onVideoView() was depricated, and you should use

    @Override
        public void onAdEnd(boolean wasSuccessfulView, boolean wasCallToActionClicked) {
            // Called when the user leaves the ad and control is returned to your application        
            // if wasSuccessfulView is true, the user watched the ad and should be rewarded        
            // (if this was a rewarded ad).
            // if wasCallToActionClicked is true, the user clicked the call to action
            // button in the ad.
        }
    

    If the ad completely by the user, the wasSuccessfulView boolean will be true.

    If you have more question feel free to contact us at [email protected] and we will help you out.

    Gabor