Ap Story Ads are a visually immersive ad format designed for integration between story-style or reel-like content. Ideal for apps with swipeable, full-screen media experiences, Ap Story Ads appear seamlessly between user-generated content and support rich media creatives. These ads can be skipped or interacted with, ensuring a non-intrusive yet engaging monetization experience.
You can use our demo app as a reference project.
📎 GitHub: https://github.com/adpushup/ApMobileSDKDemo/tree/master/ApStoryAdExample
To implement Ap Story Ad in your app, follow these steps:
To load an ad, use the loadAd method:
val apStory = ApStory("AP_PLACEMENT_ID")
apStory.loadAd(context, object : ApStoryListener {
override fun onComplete(success: Boolean) {
if (success) {
// Ad successfully loaded
}
}
override fun onError(code: Int, message: String) {
// Handle error
}
})
Best for Story-style integration
- Enable/Disable Mapping of Ad’s Click-To-Action (CTA) to Swipe Up gesture.
- Enable/Disable Click To Dismiss Action For Ad.
- Disables Click-To-Action (CTA) on the Ad’s Media View itself.
val adView = apStory.getAd(
context,
isSwipeUpGestureEnabled = true,
isClickDismissEnabled = true
) {
// Callback when ad is dismissed. You can move to next story.
}
adView?.let { parentLayout.addView(it) }Best for Reels/Shorts-style integration
- Disables Mapping of Ad’s CTA to Swipe Up gesture.
- Disables Click To Dismiss Action For Ad.
- Enables CTA on the Ad’s Media View itself.
val adView = apStory.getAd(context)
adView?.let { parentLayout.addView(it) }Destroy the ad when it is no longer needed:
apStory.destroy()-
Preloading Multiple Ads:
To improve ad availability and avoid placeholders, preload multiple ads in advance.
fun preloadAds(context: Context, adPlacementIds: List<String>, callback: (List<ApStory>) -> Unit) { val adStories = mutableListOf<ApStory>() var processedCount = 0 for (placementId in adPlacementIds) { val apStory = ApStory(placementId) apStory.loadAd(context) { success -> processedCount++ if (success) { adStories.add(apStory) } if (processedCount == adPlacementIds.size) { callback(adStories) } }) } }
-
Scale Type for Ad Media View:
You can define how the media content should scale within the ad’s media view.
apStory.setMediaScaleType(ImageView.ScaleType.CENTER_CROP)
-
Checking Ad Load Status:
To check if an ad has loaded, use the
isAdLoaded()method.val isLoaded: Boolean = apStory.isAdLoaded()
-
Checking Ad Shown Status:
Calling
getAd()sets the Ad Shown status to true. If an ad has already been shown,getAd()will return null.val isUsed: Boolean = apStory.isAdShown()
-
Checking Ad Destroy Status:
When
destroy()is called, ad resources are cleaned up, andgetAd()will returnnull.val isDestroyed: Boolean = apStory.isDestroyed()