In order to initialize OfferWall, the following parameters should be passed in initialization call: APP_ID, SECRET_KEY and USER_ID.
The call should look similar to:
public static string YOUR_OW_APP_ID = ""; //set your value
public static string YOUR_OW_SECRET_KEY = ""; //set your value
public static string YOUR_OW_USER_ID = ""; //set your value
OTOfferWallSettings.Instance.configInit(YOUR_OW_APP_ID, YOUR_OW_SECRET_KEY, YOUR_OW_USER_ID);
//optional
OTOfferWallSettings.Instance.configSubids(SUBID1, SUBID2, SUBID3);
Note:
OfferToro SDK instances should be created by calling the following method:
OTSDK.Instance.Create();
After being successfully initialized, the OfferWall could be displayed into the app. For displaying the OfferWall ShowOfferWall()
method should be called:
SDKInit.Instance.ShowOfferWall();
The OfferToro SDK gives a possibility to be notified of events happening in OfferWall lifecycle via OfferWall actions.
The following actions are available in DelegateController:
Action InitSuccessOWAction
- invoked when OfferWall is successfully initialized;
Action
- invoked when OfferWall initialization fails and receives an error message (@param type string - errorMessage
) describing the reason for failure;
Action OpenOWAction
- invoked when OfferWall is displayed;
Action
- automatically invoked every several minutes and receives user's balance (first @param type float - totalCredits
) and the amount of credits the user has earned (second @param type float- credits
) since the last update.
The action could also be updated on demand at any point of time by calling GetOfferWallCredits()
method.
Action CloseOWAction
- invoked when OfferWall is closed.
To be notified of OfferWall 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() {
OTOfferWallSettings.Instance.configInit(YOUR_OW_APP_ID,
YOUR_OW_SECRET_KEY, YOUR_OW_USER_ID);
DelegateController.Instance.InitSuccessOWAction += OnOWInitSuccess;
}
void Destroy(){
DelegateController.Instance.InitSuccessOWAction -= OnOWInitSuccess;
}
Where OnOWInitSuccess()
is the method that you intend to subscribe to InitSuccessOWAction
action.
The OfferToro SDK gives possibility to receive an event via Action
in OfferWall lifecycle at any point of time by calling SDKInit.Instance.GetOfferWallCredits()
method.
The OfferToro SDK supports two ways to reward your users. Those are:
Client-side postback
User’s balance and the amount of credits the user has recently earned are available via Action
action. This action should be fired after method SDKInit.Instance.GetOfferWallCredits()
is called.
Calling SDKInit.Instance.GetOfferWallCredits()
method every several minutes is recommended .
Server-to-Server postback
Server to Server postbacks is a more secure way to receive notifications, in order to reward 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.