Service / AdsState
AdsState Enumeration
Advertising status, the advertising status that may be returned when calling the show method
Table of contents
Enumeration Members
Click = 3 |
---|
Close = 1 |
Fail = -1 |
Reward = 4 |
Skip = 2 |
Success = 0 |
Timeout = 5 |
Enumeration Members
Click
• Click = 3
The user click. When the user click on the content in the Ads, whether the Ads is played or not. Clicking on the content in the advertisement while watching it will trigger this callback. I usually don't add logic here
Close
• Close = 1
User closed. Call back when the user closes the Ads interface, no matter whether the Ads is played or not. This is the last state when Ads is playing normally, so it is appropriate to make a reward judgment here. Since it takes some time for the user to return to the game after closing the Ads, it is recommended to add an appropriate delay} in if (state==1) {to avoid the logic failure of some subsequent games due to the game suspension when Ads is placed.
Fail
• Fail = -1
Display failed. When the display advertisement fails, it will callback, usually due to network lag. Suggest doing fault tolerance here
Reward
• Reward = 4
Get rewards. Only incentive Ads will return to this. The user has finished playing Ads, whether or not click to close the interface of Ads. You can set a variable CanGetReward before the Ads is played to determine whether Player can get rewards: if (state==4) {When this callback appears, modify the value of CanGetReward}
, so that when the state==1 user closes the Ads, the reward will be given. Try not to give rewards here, because when the callback state==4 occurs, players are likely still in the advertising stage and have not returned to the MW game yet.
Skip
• Skip = 2
The user skipped. Call back when the user click to skip the Ads, whether or not the Ads is played. When some Ads are almost finished, a skip button will be given, and this callback will appear when click skip. I usually don't add logic here.
Success
• Success = 0
Start showing. Callback when starting to display advertisements, regardless of whether the advertisement playback is completed or not. This can be used to "protect" Player. After the Ads is successfully played, the Player client is in a "suspended" state. If necessary, some protective logic can be added here, such as temporarily teleporting players away when placing advertisements, and switching back after state==1 closes the advertisement.
Timeout
• Timeout = 5
The ad playback timeout usually occurs when the version of the ad API is too low. Here, users can be prompted to upgrade to version app