AdMobRewardedVideo

The AdMobRewardedVideo item allows monetizing your app with rewarded video ads on Android and iOS. More...

Import Statement: import VPlayPlugins 1.0
Since: V-Play 2.13.0
Inherits:

PluginItem

Properties

Signals

Methods

Detailed Description

Rewarded videos are skippable full-screen videos shown to the user.

You can reward the user for watching a full video until the end. You can choose how this reward looks like: give away some virtual currency, virtual items or unlock features within your app or game are popular examples.

Note: In contrast to interstitials, it is not possible to have more than one AdmobRewardedVideo item in your code. This restriction comes from the native AdMob SDK for iOS and Android.

Here is an example how you can reward the user with virtual currency after he watched a rewarded video ad:

 import VPlay 2.0
 import VPlayApps 1.0
 import VPlayPlugins 1.0
 import QtQuick 2.0

 App {
   id: app
   // start currency
   property int token: 20

   NavigationStack {

     Page {
       title: "Admob"

       // we show the token in the navigation bar
       rightBarItem: NavigationBarItem {
         AppText {
           anchors.verticalCenter: parent.verticalCenter
           text: app.token
           color: Theme.isIos ? Theme.tintColor : "white"
           font.bold: true
         }
       }

       AdMobRewardedVideo {
         id: myRewardedVideo

         // test ad for rewarded videos
         // create your own from the AdMob Backend
         adUnitId: system.isPlatform(System.IOS) ? "ca-app-pub-3940256099942544/1712485313" : "ca-app-pub-3940256099942544/5224354917"

         // if the video is fully watched, we add 10 token
         onRewardedVideoRewarded: {
           app.token += 10
         }

         onRewardedVideoClosed: {
           // load a new video every time it got shown, to give the user a fresh ad
           loadRewardedVideo()
         }

          // load interstitial at app start to cache it
         onPluginLoaded: {
           loadRewardedVideo()
         }
       }

       AppButton {
         anchors.centerIn: parent
         text: "Token--"
         onClicked: {
           // decrease token by 1
           app.token--

           if(app.token < 10) {
             // show the new video if user is below 10 token
             myRewardedVideo.showRewardedVideoIfLoaded()
           }
         }
       }
     }
   }
 }

With this example code, you can motivate users to watch an ad because they get something for it. Those users who do not want to watch an ad, can also purchase a virtual currency with the above code example. By only showing the ad if the user is below a certain virtual currency threshold, you guarantee users who bought a virtual currency pack do not see the ad.

Hint: We have this mechanism in place in the popular One Card game - you can use its full source code and copy it to your app. This also includes a real in-app purchase implementation with our free in-app purchase plugin.

Rewarded ads are the preferred way to use mobile ads these days, so we highly recommend to use this feature in your apps. The perfect time to show a rewarded ad is when a user navigates between pages of your app. For example after he finished a game or after he had a success moment like completing a level. You could motivate the user even more to watch an ad by giving extra benefits after such a success moment. This helps you to earn money, while on the other hand giving a benefit to the user - a win-win situation.

For more information on the other available ad types and how to add this component to your app, see the AdMob Plugin.

Property Documentation

adUnitId : string

Provide your Ad unit ID retrieved from the AdMob console in the format ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx here. If you do not have an AdMob account yet, you can create a new one at http://www.google.com/ads/admob/. Once you are logged in, you can acquire a new Ad unit ID by creating a new app and defining a new ad unit.

This QML property was introduced in V-Play 2.13.0.


childDirectedTreatment : bool

Set this property to true if you want to indicate that you want Google to treat your content as child-directed. Google will then take steps to disable IBA and remarketing ads for your ads.

More information can also be found here.

This QML property was introduced in V-Play 2.13.0.


designedForFamilies : bool

Set this property to true if you have opted your app in to Google Play's Designed for Families program.

Note: This property is only applicable for Android. You need to ensure ads comply with the Designed for Families program requirements and ad policies.

More information can also be found here.

This QML property was introduced in V-Play 2.13.0.


testDeviceIds : list<string>

Provide your device id as an array of string values here to receive test ads for the specific test devices.

Note: If you test your application with live ads frequently, Google might ban your account for fraud. Therefore if you are not able to provide the testDeviceIds and test with live ads instead.

You can find your testdeviceIds in the device log after you first run an your app with integrated AdMob plugin, search for "To get test ads on this device, call adRequest.addTestDevice".

This QML property was introduced in V-Play 2.13.0.


Signal Documentation

rewardedVideoClosed()

This handler is called when a rewarded video is dismissed by the user, either while it was still playing or has already finished. If the user watched the video until the end, rewardedVideoRewarded will also be called.

This QML signal was introduced in V-Play 2.13.0.

See also rewardedVideoRewarded, loadRewardedVideo(), and showRewardedVideoIfLoaded().


rewardedVideoFailedToReceive()

This handler is called if a rewarded video can not be loaded, e.g. due to a network error.

This QML signal was introduced in V-Play 2.13.0.

See also loadRewardedVideo() and showRewardedVideoIfLoaded().


rewardedVideoLeftApplication()

This handler is called after the user clicked an ad while the video was playing and the app is going to be moved to the background to display the ad, e.g. in a browser.

This QML signal was introduced in V-Play 2.13.0.

See also loadRewardedVideo() and showRewardedVideoIfLoaded().


rewardedVideoOpened()

This handler is called when a rewarded video ad is displayed. At this point in time, the video might still be loading, rewardedVideoStarted will be emitted when it actually starts playing.

This QML signal was introduced in V-Play 2.13.0.

See also rewardedVideoStarted, loadRewardedVideo(), and showRewardedVideoIfLoaded().


rewardedVideoReceived()

This handler is called after the loadRewardedVideo() request has finished and the rewarded video is ready to display.

This QML signal was introduced in V-Play 2.13.0.

See also loadRewardedVideo() and showRewardedVideoIfLoaded().


rewardedVideoRewarded()

This handler is called when the user finished watching the video and can be rewarded by the app.

This QML signal was introduced in V-Play 2.13.0.

See also rewardedVideoClosed, loadRewardedVideo(), and showRewardedVideoIfLoaded().


rewardedVideoStarted()

This handler is called when a rewarded video has started playing.

This QML signal was introduced in V-Play 2.13.0.

See also rewardedVideoOpened, loadRewardedVideo(), and showRewardedVideoIfLoaded().


Method Documentation

void loadRewardedVideo()

Call this method to start downloading a rewarded video ad in the background. When finished, the rewardedVideoReceived signal will be emitted.

This QML method was introduced in V-Play 2.13.0.

See also rewardedVideoReceived and showRewardedVideoIfLoaded().


void showRewardedVideoIfLoaded()

This method displays a rewarded video ad that was previously requested via a call to the loadRewardedVideo() method.

For example, it can be called directly after rewardedVideoReceived is emitted:

 import VPlayApps 1.0
 import VPlayPlugins 1.0

 App {
   NavigationStack {
     Page {
       title: "Admob Rewarded Video"

       AdMobRewardedVideo {
         adUnitId: system.isPlatform(System.IOS) ? "ca-app-pub-3940256099942544/1712485313" : "ca-app-pub-3940256099942544/5224354917" // rewarded video test ad by AdMob
         testDeviceIds: [ "" ]

         onRewardedVideoReceived: {
           showRewardedVideoIfLoaded()
         }

         onPluginLoaded: {
           loadRewardedVideo()
         }
       }
     }
   }
 }

This QML method was introduced in V-Play 2.13.0.

See also loadRewardedVideo() and rewardedVideoReceived.


Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support