Create an Android In-app Bidding Adapter
This article relates the technical implementation of an Android custom bidding adapter. If you want to know more about in-app bidding or the reasons why you should create a custom bidding adapter and how to do it, please go to in-app bidding overview or the custom adapter page.
SASBidderAdapter
interface
To create your custom bidder adapter, you must create a class that implements the SASBidderAdapter
interface.
Most of the properties should be set upon initialization of your adapter, even if they will only be "consumed" server-side when the adapter informations are forwarded to Smart through the ad call.
Please refer to the API documentation for complete list of the properties and methods to be implemented.
Competition type
When initializing your adapter, make sure to return the proper CompetitionType
:
SASBidderAdapter.CompetitionType.Price
means that Smart Display SDK will pass the price and the currency as parameters of the ad call, unobfuscated. With this competition type, you must implement thegetPrice()
andgetCurrency
methods of the adapter.SASBidderAdapter.CompetitionType.Keyword
means that Smart Display SDK will pass a representation of the price, as a keyword, in the ad call. This keyword must match with the keyword targeting of a programmed insertion that has also an eCPM priority and CPM filled in the ad server. With this competition type, you must implement thegetKeyword()
of the adapter.
Rendering type
When initializing your adapter, make sure to return the proper creative RenderingType
:
SASBidderAdapter.RenderingType.PrimarySDK
means that Smart Display SDK will be responsible for rendering the winning creative whether it comes from the ad server or the in-app bidding competition. Therefore your adapter must provide the HTML Ad Markup to be displayed through thegetBidderWinningAdMarkup
method (see below).SASBidderAdapter.RenderingType.ThirdParty
means that your partner's SDK will ultimately be responsible for rendering the winning creative and that a third party (such as your application) will trigger it. This situation occurs if Smart's ad-server loses the bidding competition. If the winning creative comes from Smart, the display will be done by Smart Display SDK as usual.
Note : this is the only available rendering type for a native ad integration, as the application is always in charge of rendering the native ads.SASBidderAdapter.RenderingType.Mediation
means that your partner's SDK will ultimately be responsible for rendering the winning creative but that the Smart Display SDK will mediate this rendering through the adapter and forward all necessary callbacks to the delegate of the instanciated Smart Display SDK ad view. This situation occurs if Smart's ad-server loses the bidding competition. If the winning creative comes from Smart, the display will be done by Smart Display SDK as usual.
Win notification callback
When the ad-server loses the server-side competition, meaning that it was not able to return an ad with a higher CPM than the third party bidder, Smart Display SDK will trigger the method:
When this method is called, you should perform all actions you think relevant to log the competition result.Rendering methods
Several methods can be called for the rendering to occur, depending on the rendering type of the adapter.
Smart Display SDK Creative Rendering
This corresponds to the SASBidderAdapter.RenderingType.PrimarySDK
rendering type. For rendering of the creative to occur properly, your adapter must implement these methods:
Third party Creative Rendering
This corresponds to the SASBidderAdapter.RenderingType.ThirdParty
rendering type. For rendering of the creative to occur properly, your adapter must implement this method:
Mediation Creative Rendering - Banners
This corresponds to the SASBidderAdapter.RenderingType.Mediation
rendering type for banner ads.
Since the Smart banner view is in charge of displaying the third party banner, it expects that your adapter actually implement the SASBannerBidderAdapter
interface (that extends the SASBidderAdapter
interface), adding this method:
onBannerLoaded(@NonNull View mediatedBanner)
method of the SASBidderBannerAdapterListener
instance passed in parameter.
You will also have to notify the Smart SDK of subsequent events occuring on the third party banner by calling appropriate methods on that SASBannerBidderAdapterListener instance, such as onAdClicked()
. Please refer to the SASBannerBidderAdapterListener
reference documentation to see all available callback methods.
Mediation Creative Rendering - Interstitial
This corresponds to the SASBidderAdapter.RenderingType.Mediation
rendering type for interstitial ads.
Since the Smart interstitial manager is in charge of displaying the third party interstitial, it expects that your adapter actually implement the SASInterstitialBidderAdapter
interface (that extends the SASBidderAdapter
interface), adding these methods:
loadBidderInterstitial(@NonNull SASInterstitialBidderAdapterListener interstitialBidderAdapterListener)
showBidderInterstitial()
loadBidderInterstitial(@NonNull SASInterstitialBidderAdapterListener interstitialBidderAdapterListener)
method is called, you have to render the interstitial creative using the third party SDK that won the bid, and notify the Smart SDK when it is ready to be displayed by calling the onInterstitialLoaded()
method of the SASInterstitialBidderAdapterListener
instance passed in parameter.
When the showBidderInterstitial()
method is called, you have to show the interstitial creative using the third party SDK that won the bid, and notify the Smart SDK when it is actually displayed by calling the onInterstitialShown()
method of the SASInterstitialBidderAdapterListener
instance passed in parameter.
You will also have to notify the Smart SDK of subsequent events occuring on the third party interstitial by calling appropriate methods on that SASInterstitialBidderAdapterListener instance, such as onAdClicked()
. Please refer to the SASInterstitialBidderAdapterListener
reference documentation to see all available callback methods.