Video Reward Fix On Buildbox Classic 2.21.4 (android)

Discussion in 'Buildbox General Discussion' started by Vlad-NY, Aug 17, 2021.

  1. Vlad-NY

    Vlad-NY Serious Boxer

    Joined:
    Jul 21, 2018
    Messages:
    510
    Likes Received:
    314
    Hey boxers,

    It's been a while since I did not make a new thread but here I come with a new tutorial/fix for bb classic users. I happen to know that since the classic release the Reward video mechanic is no longer functional on Android devices so I've decided to invest some time to see if I can come up with a fix.

    The idea is that based on my investigation the rewarded video is working but the trigger for the actual reward is not, therefore, you see it working in preview but not on the device.

    So what do you need to do to fix it?
    1 Export your game to Android
    2 Open it in Android studio
    3 Open PTAdAdMobBridge.java (my path is android/app/src/main/java/com/secrethq/ads/PTAdAdMobBridge.java)
    4 Scroll down to public static void showRewardedVideo() method (on line 309)
    5 replace line 321 (// rewardedVideoDidReward(true); with rewardedVideoDidEnd(); )
    6 Build the apk, install on app and enjoy


    Note: For those of you who can't follow the above instruction on line 321 please replace the whole method with the following code:
    Code:
     public static void showRewardedVideo() {
            Log.v(TAG, "showRewardedVideo");
            Activity activityRef = activity.get();
    
            if(rewardedVideo != null) {
                activityRef.runOnUiThread(new Runnable() {
                    public void run() {
                        rewardedVideo.show(activityRef, new OnUserEarnedRewardListener() {
                            @Override
                            public void onUserEarnedReward(@NonNull RewardItem rewardItem) {
                                Log.d(TAG, "Rewarded - onUserEarnedReward");
                                //TODO: Implement tracking for events
                                rewardedVideoDidEnd(); // THIS IS WHERE THE MAGIC HAPPENS
                            }
                        });
                    }
                });
            }
        }

    So far I was able to check and confirm that with the above fix all the ads are working on Android studio (Banners, Interstitials and Rewarded videos)

    * Can someone please send me a PM or comment with an update on iOS devices using admob integration?
     
    HG-2018, Jaro and Nicki like this.
  2. HG-2018

    HG-2018 Avid Boxer

    Joined:
    Jun 18, 2018
    Messages:
    309
    Likes Received:
    162
    Thanks for the video. Would be nice if the support could fix something like that quickly. ;)
     
  3. HG-2018

    HG-2018 Avid Boxer

    Joined:
    Jun 18, 2018
    Messages:
    309
    Likes Received:
    162
    I did it as you described the reward videos go again only unfortunately you do not get the reward. In my case 100 coins. :(
     
  4. Vlad-NY

    Vlad-NY Serious Boxer

    Joined:
    Jul 21, 2018
    Messages:
    510
    Likes Received:
    314
    Check your configuration on action or purchase button to be set to default and not one time payment or something between those lines
     
  5. HG-2018

    HG-2018 Avid Boxer

    Joined:
    Jun 18, 2018
    Messages:
    309
    Likes Received:
    162
    I have it on this settings but it doesn't work. But when I test it in buildbox it works I get the coins.
     
    Last edited: Aug 20, 2021
  6. Vlad-NY

    Vlad-NY Serious Boxer

    Joined:
    Jul 21, 2018
    Messages:
    510
    Likes Received:
    314
    Make sure you have this line of code

    rewardedVideoDidEnd();

    in the right spot in android studio after you export the file. That will enable the reward, the issue with export is that the event is triggered but the reward is not and that line will fix it if you make the right change otherwise it won't work
     
  7. HG-2018

    HG-2018 Avid Boxer

    Joined:
    Jun 18, 2018
    Messages:
    309
    Likes Received:
    162
    I have copied your description exactly. Since it is not so difficult, everything should be correct. ;) The settings I have made as I had always set them in my other games. ( Checked several times) :) Unfortunately, the reward is given after the reward video. Would also be nice times when he reigns support. ;)

    @Sean Buildbox @NikRudenko @Hue Buildbox
     
  8. Vlad-NY

    Vlad-NY Serious Boxer

    Joined:
    Jul 21, 2018
    Messages:
    510
    Likes Received:
    314
    The concept for this is to get the reward only if he watches the video until the end.

    That's why it works like that. If you want to give the reward without the need for the user to watch the whole video then this is not the fix for you. It is the base for what you'll need to do.
     
  9. HG-2018

    HG-2018 Avid Boxer

    Joined:
    Jun 18, 2018
    Messages:
    309
    Likes Received:
    162
    Even if I play the whole video it does not work. You do not get any reward. I can gladly show it with a video. Reward video go reward you do not get! In buildbox it goes you do not have to watch videos, but you get the reward. As soon as I test it on Android devices the video goes but you don't get a reward.

     
    Last edited: Aug 21, 2021
  10. Vlad-NY

    Vlad-NY Serious Boxer

    Joined:
    Jul 21, 2018
    Messages:
    510
    Likes Received:
    314
    if you use test ad id's is it working? I see that you've used real ad ids. I've tested this with test ad ids and it was working. If for instance the fix is working with test ads but not with real ads then you need to reach out admob and ask them to review your profile because the callback is not sent out (with real ads) if even with test ads the reward is not there than you've missed something.

    Let me check this, what version did you export your app on? What buildbox version do you use?
     
  11. HG-2018

    HG-2018 Avid Boxer

    Joined:
    Jun 18, 2018
    Messages:
    309
    Likes Received:
    162
    It is the latest version the ID goes with all other app that was not made with buildbox Classic without problem. And addmob it is definitely not, because as I said all the others that were exported with buildbox 2 go without problems. Since the update of buildbox Classics it no longer works. It's not my first game I made with it and yes all settings are the same. I am using the latest version of buildbox 2.21.4. It is definitely buildbox. Unfortunately the support is not responding. It's sad that this "bug", which is definitely there, is not fixed by a fix.
     
  12. Vlad-NY

    Vlad-NY Serious Boxer

    Joined:
    Jul 21, 2018
    Messages:
    510
    Likes Received:
    314
    Would you mind finding me on discord and sending me the file so I can take a look? I can't believe that if you update the proper methods in Android studio my fix won't work on your file because of other reasons... Or just a template with your setup, doesn't matter what you use
     
  13. HG-2018

    HG-2018 Avid Boxer

    Joined:
    Jun 18, 2018
    Messages:
    309
    Likes Received:
    162
    I think I will send the bbdoc to the support and they can help me more as you.
     
  14. Vlad-NY

    Vlad-NY Serious Boxer

    Joined:
    Jul 21, 2018
    Messages:
    510
    Likes Received:
    314
    Alright, good luck with that! I'm sure they will help you release your next hit game :)
     
  15. Vlad-NY

    Vlad-NY Serious Boxer

    Joined:
    Jul 21, 2018
    Messages:
    510
    Likes Received:
    314
    Have you thought to install a clean build without my fix applied to see if that works? (if rewarded video system)
     

Share This Page