Parental gate
You can optionally add the AA Parental Gate to an ad placement. The Parental Gate is a dialog that appears when a user clicks on an ad. It is designed to prevent very young users from clicking on an ad without their parent’s assistance.
When the user clicks on the ad, the Parental Gate dialog is displayed. It presents a math challenge which the user must solve to proceed to the ad.
The Parental Gate is disabled by default. To use the Parental Gate, see the following code and examples.
Enable/disable the Parental Gate
- To enable the Parental Gate on one banner ad:
mybanner.enableParentalGate();
or
mybanner.setParentalGate(true);
- To disable the Parental Gate on one banner ad:
mybanner.disableParentalGate();
or
mybanner.setParentalGate(false);
- To enable the Parental Gate on all interstitial ads:
SAInterstitialAd.enableParentalGate();
or
SAInterstitialAd.setParentalGate(true);
- To disable the Parental Gate on all video ads:
SAVideoAd.disableParentalGate();
or
SAVideoAd.setParentalGate(false);
Example
import tv.superawesome.sdk.publisher.*;
public class MainActivity extends Activity {
private SABannerAd banner = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// get the banner
bannerAd = (SABannerAd) findViewById(R.id.mybanner);
// enable the Parental Gate on the banner
bannerAd.enableParentalGate();
// add a callback
bannerAd.setListener(new SAInterface() {
@Override
public void onEvent(int placementId, SAEvent event) {
if (event == SAEvent.adLoaded) {
bannerAd.play(MainActivity.this);
}
}
});
// start the loading process
bannerAd.load(30471);
}
}
import tv.superawesome.sdk.publisher.*;
class MainActivity : Activity() {
private lateinit var bannerAd: SABannerAd
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// get the banner
bannerAd = findViewById<SABannerAd>(R.id.mybanner)
// enable the Parental Gate on the banner
bannerAd.enableParentalGate()
// add a callback
bannerAd.setListener { placementId, event ->
if (event == SAEvent.adLoaded) {
bannerAd.play(this@MainActivity)
}
}
// start the loading process
bannerAd.load(30471)
}
}