Overview
Popup ads are displayed as a popup at the center or bottom of the screen. They support a “Don’t show today” feature to improve user experience.Key Features
- Selectable center or bottom position
- “Don’t show today” feature support
- Customizable button colors
- Image ad support
Use test unit IDs in development environment:
- Bottom:
PUBLIC_TEST_UNIT_ID_POPUP_BOTTOM - Center:
PUBLIC_TEST_UNIT_ID_POPUP_CENTER
AdropPopupAd
Constructor
| Parameter | Type | Required | Description |
|---|---|---|---|
unitId | String | Y | Unit ID created in Ad Control Console |
listener | AdropPopupListener | N | Ad event listener |
closeTextColor | Color | N | Close button text color |
hideForTodayTextColor | Color | N | ”Don’t show today” button text color |
backgroundColor | Color | N | Button background color |
Properties
| Property | Type | Description |
|---|---|---|
isLoaded | bool | Whether ad is loaded |
unitId | String | Ad unit ID |
creativeId | String | Creative ID |
txId | String | Transaction ID |
campaignId | String | Campaign ID |
destinationURL | String | Destination URL |
browserTarget | BrowserTarget? | Browser target (external or internal) |
Methods
| Method | Return Type | Description |
|---|---|---|
load() | Future<void> | Loads the ad |
show() | Future<void> | Shows the ad on screen |
close() | Future<void> | Closes the ad |
dispose() | Future<void> | Releases resources |
Basic Usage
AdropPopupListener
Listener for handling popup ad events.Callbacks
Callback Descriptions
| Callback | Description |
|---|---|
onAdReceived | Called when ad loads successfully |
onAdClicked | Called when ad is clicked |
onAdImpression | Called when ad is shown |
onAdWillPresentFullScreen | Called just before ad is presented (iOS only) |
onAdDidPresentFullScreen | Called after ad is presented |
onAdWillDismissFullScreen | Called just before ad is dismissed (iOS only) |
onAdDidDismissFullScreen | Called after ad is dismissed |
onAdFailedToReceive | Called when ad fails to load |
onAdFailedToShowFullScreen | Called when ad fails to show |
onAdVideoStart | Called when video ad starts playing |
onAdVideoEnd | Called when video ad finishes playing |
Button Color Customization
You can customize the colors of the close button and “Don’t show today” button.Color Options
| Parameter | Description | Default |
|---|---|---|
closeTextColor | Close button text color | System default |
hideForTodayTextColor | ”Don’t show today” button text color | System default |
backgroundColor | Button background color | System default |
Popup Position
The popup position is configured when creating the unit in the Ad Control Console.Center Popup
The popup is displayed at the center of the screen. Suitable for announcements and event notifications.Bottom Popup
The popup is displayed at the bottom of the screen. Suitable for banner-style notifications on app launch.Don’t Show Today
When a user selects “Don’t show today”, the ad will not be shown on that device until midnight.When loading an ad in “Don’t show today” state, the
adHideForToday error is returned.Ad Recreation
Popup ads are one-time use. Once shown, they cannot be shown again, so you must recreate the instance to load a new ad.Error Handling
Best Practices
1. Show Popup on App Launch
Display announcements or events as a popup when the app launches.2. Use Theme-Matched Colors
Set button colors to match your app’s theme.3. Resource Management
Always dispose of unused ad instances.Complete Example
Backfill Ads
When backfill ads are enabled, backfill ads are automatically loaded when direct ads are unavailable. You can handle backfill-related errors using the error code.To use backfill ads, add the backfill dependency to native platforms. See Getting Started.
Next Steps
Targeting
Set up targeting for personalized ads
Reference
Reference types, methods, and error codes
Examples
Explore various implementation examples