Flurry ad units represent unique placements in the app. If your app supports multiple ad placements, you’ll need to create multiple ad units.
Use Flurry Analytics to determine the places in your app that have the highest user traffic and session times. Typically, good placements include the top of screen or a fixed location on the bottom of the screen showing the Activity with the highest user traffic.
How To Serve Banner Ads¶
- To serve banner ads, you can create an instance of the
FlurryAdBannerobject, and call its method
fetchAndDisplayAd(), enabling the SDK to present the ad as soon as it is available.
Alternatively, you can fetch banners asynchronously when the Activity is started and display it as soon as the banners are made available by the SDK in the FlurryAdBannerListener’s onFetched(adBanner)` call.
For details on using
FlurryAgent.onStartSession(), see Get Started With Android.
These are the parameters when using FlurryAdBanner:
Context context- Flurry advises using the current Activity.
String adSpace- Unique name of your ad placement defined on the Flurry website.
ViewGroup viewSpace- ViewGroup inside the Context that you want the ad to reside in. Flurry suggests using a
FlurryAdErrorType adErrorType- Ad error types.
- To be notified of certain events during the full lifecycle of the Ad, implement the FlurryAdBannerListener interface and then call the
setListenermethod to attach your implementation of FlurryAdBannerListener to the Flurry SDK. You will need to implement the following callback methods:
A banner’s position on the screen is, by default, on the top or the bottom of the screen. The suggested RelativeLayout defined in your layout for the activity determines its actual location. You can use it to place the banner in the non-standard top or bottom position.
Once displayed, the banners are refreshed every 30 seconds until the
adBanner.destroy is called. The default 30 seconds refresh can be changed on the dev portal. For more information, see the Ad Refresh section in Advanced Settings.
- Run the app and observe how Flurry ads are fetched and displayed.
If you are not seeing any ads, check the troubleshooting section in FAQs for Android.
Was this document helpful?