Integrate Game Breaks
Prerequisite: make sure you integrate the Game API and it’s loading correctly before continuing (see Load the API).
Game Breaks are logical pauses(*) during the game. They are offering us the ability to pause the game and display a message to the users, we mostly use them to display in-game ads. We make sure that users aren’t exposed to too much advertising and get the most relevant ads.
These advertisements can be either an image or a video ad. Depending on the contract you have with us, we share revenues on the revenues generated.
- (*) Logical pause or break moments are defined by the game developer. For example, right before the next level begins.
Three simple rules:
- Game breaks requests (Natural moments) can be called as often as you want. We will allow them once a time.
- Game breaks requests are accepted asynchronously, make sure that your game will continue to play only after the resumeGame callback is triggered.
- Your game must also mute the sound when it’s paused.
Pausing and Resuming your game
Implement two (global) functions in your game so it can be paused and resumed. While the pause method will be called only when there is an ad to be displayed the resume will always be triggered in the end of the process. For this example we will create two placeholders showing a console log:
Calling a Game Break request
After setting up your pause and resume functions, calling an ad request is simple. Just implement the following line on all possible natural break moments: