Rewarded
This article will go through all the steps required to display a Rewarded ad in your application.
Last updated
This article will go through all the steps required to display a Rewarded ad in your application.
Last updated
Rewarded ads are skippable fullscreen ads. They allow you to reward users with in-app items for watching ads.
Rewarded ads can only be served to users who explicitly and previously chose to view a rewarded ad. You can specify the reward values associated with the ad units in your application and set different rewards for different ad units.
Ensure your application is registered on the Ogury Dashboard. If not, please refer to the Getting Started page before proceeding.
on your asset page in the Ogury Dashboard.
, as you will need it for integration. It is in the form of a UUID, which consists of a 36-character string formatted as follows: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
, where each x
represents a hexadecimal digit.
In the following code samples, this ad unit ID will be represented as xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
.
To load a Rewarded ad, instantiate an OguryRewardedAd
object and call its load()
method.
OguryRewardedAd
requires the following parameters:
context
: a reference to any kind of Context.
adUnitID
: the ad unit ID for the Rewarded ad. If you do not have one, please refer to the first step to create it.
If you are developing a mediation adapter, you must pass an additional parameter, OguryMediation
which should be instantiated with:
name
: the name of the mediation.
version
: the version of the mediation SDK.
You can monitor the lifecycle of your Rewarded ad by implementing the OguryRewardedAdListener
interface. This listener provides real-time updates on key events, such as successful ad loading, display, reward or errors.
To use it, set the listener on the instance of OguryRewardedAd
by calling the setListener()
method before invoking the load()
method. Implement the necessary methods in your class to ensure timely notifications, allowing you to manage the ad experience effectively.
The onAdRewarded
callback specifically allows you to handle the rewards given to users after they interact with the ad. The reward name
and value
can be set in the Reward Settings section of your ad unit on the Ogury Dashboard.
If the onAdError
callback is triggered, refer to the Error handling section below for detailed information on troubleshooting.
To display a loaded Rewarded ad, invoke the show()
method on the instantiated OguryRewardedAd
object.
Always verify that the ad is loaded before invoking the show()
method, particularly if you are not calling it from the onAdLoaded
callback.
After registering your app, it may take up to 15 minutes before ads are available.
Ogury exclusively serves ads to users who have provided their consent. Before conducting any tests, it is essential to ensure that your implementation complies with applicable privacy regulations. For more information on the regulations supported by Ogury, please visit the Privacy compliance page.
Since our algorithm uses personalized targeting, you may not receive ads during testing. To obtain test ads, you can append _test
to your Rewarded ad unit ID in the code, for example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_test
.
For further details on test mode and enabling debug logs, please refer to the Test your implementation page.
If you are unable to load or display any Rewarded ads, we recommend logging callbacks from the OguryRewardedAdListener
to monitor the ad's lifecycle, especially the onAdError
callback. This method provides an OguryAdError
instance containing important error details:
type
: indicates the error type through the OguryAdError.Type
enum, which distinguishes between loading errors (Load
) and showing errors (Show
).
code
: An integer that identifies the specific error. Errors that can occur during ad loading or displaying are defined in the OguryLoadErrorCode
and OguryShowErrorCode
classes. Detailed explanations of these error codes are provided in the tables below to assist you in troubleshooting effectively.
message
: A descriptive message that provides additional context about the error.
You can utilize these details to diagnose the issue and take appropriate action to resolve it.
Enum value | Description |
---|---|
Enum value | Description |
---|---|
SDK_NOT_STARTED
The load could not proceed because the SDK appears to have not been started.
SDK_NOT_PROPERLY_INITIALIZED
The load could not proceed because the SDK is not properly initialized.
NO_ACTIVE_INTERNET_CONNECTION
The load could not proceed because there is no active Internet connection.
INVALID_CONFIGURATION
The load could not proceed due to an invalid SDK configuration.
AD_DISABLED_COUNTRY_NOT_OPENED
The load could not proceed because ads are disabled; the user’s country is not yet available for advertising.
AD_DISABLED_CONSENT_DENIED
The load could not proceed because ads are disabled; the user has denied consent for advertising.
AD_DISABLED_CONSENT_MISSING
The load could not proceed because ads are disabled; the user consent is missing or has not been provided.
AD_DISABLED_UNSPECIFIED_REASON
The load could not proceed because ads are disabled for an unspecified reason.
AD_REQUEST_FAILED
The load failed because the ad request encountered an error, and the server returned an unexpected response.
NO_FILL
No ad is currently available for this placement (no fill).
AD_PARSING_FAILED
The ad could not be loaded due to a failure in parsing.
AD_PRECACHING_FAILED
The ad could not be loaded due to a failure in ad precaching.
AD_PRECACHING_TIMEOUT
The ad could not be loaded as precaching exceeded the time limit and timed out.
SDK_NOT_STARTED
The ad could not be displayed because the SDK appears to have not been started.
SDK_NOT_PROPERLY_INITIALIZED
The ad could not be displayed because the SDK is not properly initialized.
NO_ACTIVE_INTERNET_CONNECTION
The ad could not be displayed because there is no active Internet connection.
INVALID_CONFIGURATION
The ad could not be displayed due to an invalid SDK configuration.
AD_DISABLED_COUNTRY_NOT_OPENED
The ad could not be displayed because ads are disabled; the user’s country is not yet available for advertising.
AD_DISABLED_CONSENT_DENIED
The ad could not be displayed because ads are disabled; the user has denied consent for advertising.
AD_DISABLED_CONSENT_MISSING
The ad could not be displayed because ads are disabled; the user consent is missing or has not been provided.
AD_DISABLED_UNSPECIFIED_REASON
The ad could not be displayed because ads are disabled for an unspecified reason.
AD_EXPIRED
The ad could not be displayed because the retention time of the loaded ad has expired.
NO_AD_LOADED
No ad has been loaded.
VIEW_IN_BACKGROUND
The ad could not be displayed because the application was running in the background.
ANOTHER_AD_ALREADY_DISPLAYED
The ad could not be displayed because another ad is currently being displayed.
WEBVIEW_TERMINATED_BY_SYSTEM
The ad could not be displayed because the WebView was terminated by the system, resulting in the ad being unloaded due to high resource consumption by the application.