Interstitial Ad
Interstitial ads are full-screen advertisements that cover the interface of their host app. They're typically displayed at natural transition points in the flow of an app, such as between activities or during the pause between levels in a app.
Integration
Step 1. Import component
You need to import bluestack_sdk.dart in order to display BlueStack interstitial ads.
import 'package:bluestack_sdk_flutter/bluestack_sdk.dart';
Step 2. Create Interstitial ad
You have to pass the platform-specific interstitial placement ID while creating an instance of InterstitialAd
// Create an interstitial ad instance
interstitialAd = InterstitialAd('/YOUR_APP_ID/interstitial');
Step 3. Load Interstitial ad
You can load a Interstitial ad using load method, right after SDK finishes it's initialization.
Here are examples of how to load an interstitial ad:
interstitialAd?.load();
With "RequestOptions":
/// [options] Optional parameters for customizing the ad request.
interstitialAd?.load(options: requestOptions);
View the RequestOptions documentation for more details.
Step 4. Display Interstitial ad
After loading the interstitial ad you can request it to be displayed using show method.
Listen to interstitial ad events to make sure the ad was successfully loaded before you call show method
Here's an example of how to show an interstitial ad:
interstitialAd?.show();
Step 5. Register event listeners
Register for interstitial ad events before loading InterstitialAd.
InterstitialAd exposes the following ad loading events through it's lifecycle.
| Events | Definition | 
|---|---|
| onAdLoaded | Ad is successfully loaded and SDK is ready to display the ad. | 
| onAdFailedToLoad | The ad failed to load. | 
Here's an example of how to register load event listeners for interstitial ads:
// Set up load event listeners
interstitialAd.setLoadEventListener(InterstitialAdLoadEventListener(
  onAdLoaded: () {
    print('Interstitial ad loaded');
  },
  onAdFailedToLoad: (error) {
    print('Interstitial ad failed to load: ${error.message}');
  },
));
InterstitialAd exposes the following ad show events through it's lifecycle.
| Events | Definition | 
|---|---|
| onAdDisplayed | Ad has appeared on the screen. | 
| onAdFailedToDisplay | The ad failed to display. | 
| onAdClicked | User has clicked the ad. Ad may open a link in browser. | 
| onAdDismissed | The ad has disappeared. | 
Here's an example of how to register show event listeners for interstitial ads:
// Set up show event listeners
interstitialAd.setShowEventListener(InterstitialAdShowEventListener(
  onAdDisplayed: () {
    print('Interstitial ad displayed');
  },
  onAdFailedToDisplay: (error) {
    print('Interstitial ad failed to display: ${error.message}');
  },
  onAdDismissed: () {
    print('Interstitial ad dismissed');
  },
  onAdClicked: () {
    print('Interstitial ad clicked');
  },
));
Dispose interstitial ad
You can dispose the interstitial using dispose method
// Don't forget to dispose when done
interstitialAd.dispose();
Best Practices
- Loading: Pre-load interstitial ads before they're needed
 - Showing: Check if interstitial was successfully loaded before trying to show
 - Event Handling: Make sure you only register event listeners once.
 - Error Handling: Always implement error handlers
 - Memory Management: Call 
dispose()when the ad is no longer needed 
Troubleshooting
Common issues and solutions:
- 
Ad Not Loading
- Check internet connectivity
 - Verify placement ID
 - Ensure SDK is properly initialized
 
 - 
Ad Not Showing
- Verify that 
load()was called successfully - Check if interstitial was successfully loaded before trying to show
 - Ensure proper timing of 
show()call 
 - Verify that 
 - 
Memory Issues
- Always call 
dispose()when done - Don't create multiple instances unnecessarily
 
 - Always call