Documentation

Here you will find all the info you need to integrate the various monetization tools OfferToro has to offer.

Unity SDK

SDK version 1.2
Updated: Feb 23, 2017

4. Rewarded Video

  • Step 1. Initialize the SDK

    In order to initialize Rewarded Video, the following parameters should be passed in the initialization call: APP_ID, SECRET_KEY and USER_ID.

    public static string YOUR_RV_APP_ID = ""; //set your value
    public static string YOUR_RV_SECRET_KEY = ""; //set your value
    public static string YOUR_RV_USER_ID = ""; //set your value
    
     OTVideoRewardedSettings.Instance.configInit(YOUR_RV_APP_ID,
                   YOUR_RV_SECRET_KEY, YOUR_RV_USER_ID);

    Note:

    • - APP_ID and SECRET_KEY can be found in your OfferToro account, under your "App Placement" settings.
    • - USER_ID, is a parameter which should be passed from your end as a unique ID for each end user of your app.
  • Step 2. Create OfferToro SDK instance

    OfferToro SDK instances should be created in the MonoBehaviour class in Start() method by calling the following method:

    DelegateController.Instance.Create();

  • Step 3. Display the Rewarded Video

    After being successfully initialized, Rewarded Video could be displayed into the app.

    For displaying the Rewarded Video ShowRewardedVideo() method should be called:

    SDKInit.Instance.ShowRewardedVideo();

  • Step 4. Subscribe to Rewarded Video listeners

    The OfferToro SDK gives a possibility to be notified of events happening in Rewarded Video lifecycle via Rewarded Video actions.

    The following actions are available in DelegateController:

    Action InitSuccessRVAction - invoked when Rewarded Video is successfully initialized;

    Action InitFailRVAction - invoked when Rewarded Video initialization fails and receives (@param type string - errorMessage) describing the reason for fail;

    Action StartedRVAction - invoked when Rewarded Video screen starts;

    Action RVAvailabilityChangedAction - automatically invoked every several minutes and indicates whether Rewarded Videos are available or not. The action could also be invoked at any point of time by calling ISVideoAvailable() method.

    Action CreditedRVAction - invoked when Rewarded Video is credited and (@param type double - amount) receives the amount of credits the user has earned for watching the video.

    To be notified of Rewarded Video events, you need to subscribe to actions in Start() method of your MonoBehaviour class and then unsubscribe in Destroy() method of your MonoBehaviour class. For example:

    void Start() {
    OTVideoRewardedSettings.Instance.configInit(YOUR_RV_APP_ID,
                   YOUR_RV_SECRET_KEY, YOUR_RV_USER_ID);
    DelegateController.Instance.InitSuccessRVAction += OnRVInitSuccess;
    DelegateController.Instance.Create();
    }
    
    void Destroy(){
        DelegateController.Instance.InitSuccessRVAction -= OnRVInitSuccess;
    }

    Where OnRVInitSuccess is the method that you intend to subscribe to InitSuccessRVAction action.

    The OfferToro SDK gives possibility to receive event via Action RVAvailabilityChangedAction in OfferWall lifecycle at any point of time by calling SDKInit.Instance.ISVideoAvailable() method.

  • Step 5. Reward the User

    The OfferToro SDK supports two ways to reward your users. Those are:

    • 1. Client-side postback
    • 2. Server-to-Server postback

    Client-side postback

    The amount of credits the user has earned for watching the video is provided automatically via Action CreditedRVAction.

    Server-to-Server postback

    Server to Server postbacks is a more secured way to receive notifications, in order to rewarded your users.
    To receive Server to Server postbacks, you must define your postback URL in your App Placement under your OfferToro account
    For more information - Please check this page.