4. Call the Inference API
Last updated
Last updated
Configure the Airflux SDK to call the Inference API before displaying ads, and use the API response to determine whether to proceed with the ad display. This step may take about 15 minutes to 1 hour.
Airflux analyzes player behavior using in-game events and player attribute data to determine the optimal timing for ad displays to maximize revenue. When calling the Inference API before showing an ad to the player, the Airflux AI will return a decision on whether to display the ad or skip it.
The InferenceShowAdInterstitial()
function should be called when the ad is supposed to be shown.
If the API call is successfully processed, the onShowAd
callback function is triggered to show the ad to the player, or the onSkipAd
callback function is triggered to skip the ad for the player.
When the API call fails, onFailure is returned. The API call may fail in the following cases:
The device's country is not in the countryAllowlist: API calls may fail for players in countries not supported by Airflux.
The inference server returns a 4XX or 5XX error response: API calls may fail due to internal server errors or invalid requests.
The API call times out after 3 seconds without a response: Network delays or other issues may cause the API response time to go beyond the limit.
Failure to call the InferenceShowAdInterstitial()
function may lead to degraded play experience and loss of ad revenue. Therefore, it is recommended that a 3-second timeout be set and a fallback be implemented to display ads to the player in case the API call fails, to minimize potential negative effects. Retry attempts upon function call failure are not required.
To confirm proper implementation, review the items below.
Ensure that the InferenceShowAdInterstitial()
function is called when the ad is supposed to be shown to the player, and verify that the logic for proceeding with ad display based on the API response is properly implemented.
In the test environment, confirm that when the onShowAd
callback is triggered, the ad is displayed, and when the onSkipAd
callback is triggered, the ad is skipped.
Test various failure scenarios for API calls (e.g., country restrictions, server errors, timeouts, etc.) to ensure the onFailure
callback is invoked correctly, and fallback procedures operate as intended.
After sufficient QA and app crash testing, deploy your gaming app.
Click for guidance on preparing for the Google Play and App Store reviews.
Congratulations! If you have completed the steps above, you are all set to optimize your in-game advertising with Airflux. Click to learn how to receive your optimization results.