Interface AdService
public interface AdService
The AdService provides methods to show the AppBrain offerwall and interstitial.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumFor use insetPopupBorder(int, BorderSize).static enumFor use in}.invalid @link
{@link AdService@setReturnToAppInterstitial(ReturnToAppConfig) -
Method Summary
Modifier and TypeMethodDescriptiongetOfferWallButtonLabel(Context context) booleanmaybeShowInterstitial(Context context) Deprecated.booleanmaybeShowInterstitial(Context context, AdOptions options) Deprecated.UseInterstitialBuilder.maybeShow(Context)instead.voidsetOfferWallClickListener(Context context, View view) Sets a view's OnClickListener to open the offer wall when clicked.voidsetOfferWallClickListener(Context context, View view, View.OnClickListener delegateClickListener) Sets a view's OnClickListener to open the offer wall when clicked.voidsetOfferWallMenuItemClickListener(Context context, MenuItem menuItem) Sets a menu item's OnMenuItemClickListener to open the offer wall when clicked.voidsetOfferWallMenuItemClickListener(Context context, MenuItem menuItem, MenuItem.OnMenuItemClickListener delegateClickListener) Sets a menu item's OnMenuItemClickListener to open the offer wall when clicked.voidsetPopupBorder(int color, AdService.BorderSize size) Adds a custom border around non-fullscreen ads.voidSet the behavior or the user-returns-to-app interstitial.voidsetUserData(AppBrainUserData data) Report data about the user or context to the AppBrain ads system.booleanshouldShowInterstitial(Context context) Query whether maybeShowInterstitial would show an interstitial now or not.booleanshowInterstitial(Context context) Deprecated.UseInterstitialBuilder.show(Context)instead.booleanshowInterstitial(Context context, AdOptions options) Deprecated.UseInterstitialBuilder.show(Context)instead.voidshowOfferWall(Context context) Shows the offer wall with the list of promoted apps.voidtagForChildDirectedTreatment(boolean tagForChildDirectedTreatment) Inform the AppBrain SDK that any subsequent requests should assume that the current user falls under the 'Child Online Privacy Protection Act' (COPPA).voidunityOfferWallButtonClick(Context context) Show the offer wall from a Unity button click.wrapListAdapter(Context context, ListAdapter adapter) Wraps your ListAdapter in anAdListAdapter, which automatically inserts ads in your ListView.wrapListAdapter(Context context, ListAdapter adapter, int layoutId, int iconId, int titleId, int descriptionId) Wraps your ListAdapter in anAdListAdapter, which automatically inserts ads in your ListView.wrapListAdapter(Context context, ListAdapter adapter, AdListAdapter.AdLayoutCreator layoutCreator, int iconId, int titleId, int descriptionId) Wraps your ListAdapter in anAdListAdapter, which automatically inserts ads in your ListView.
-
Method Details
-
shouldShowInterstitial
-
maybeShowInterstitial
Deprecated.UseInterstitialBuilder.maybeShow(Context)instead.Shows an interstitial activity at certain times. Our algorithm determines the frequency optimized for the highest click through rate. The interstitial is only shown when there is an internet connection.- Parameters:
context- the currentContext- Returns:
- true if the interstitial was shown
-
maybeShowInterstitial
Deprecated.UseInterstitialBuilder.maybeShow(Context)instead.Shows an interstitial activity at certain times. Our algorithm determines the frequency optimized for the highest click through rate. The interstitial is only shown when there is an internet connection.- Parameters:
context- the currentContextoptions- Interstitial options- Returns:
- true if the interstitial was shown
-
showInterstitial
Deprecated.UseInterstitialBuilder.show(Context)instead.Shows the interstitial if there is an internet connection.- Parameters:
context- the currentContext- Returns:
- true if the interstitial was shown
-
showInterstitial
Deprecated.UseInterstitialBuilder.show(Context)instead.Shows the interstitial if there is an internet connection.- Parameters:
context- the currentContextoptions- Interstitial options- Returns:
- true if the interstitial was shown
-
showOfferWall
Shows the offer wall with the list of promoted apps. You need to request explicit approval to use this method through contact@appbrain.com otherwise it won't generate any revenue for you. See https://www.appbrain.com/info/sdk for more information.- Parameters:
context- the currentContext
-
setOfferWallClickListener
Sets a view's OnClickListener to open the offer wall when clicked. Unlike the method showOfferWall(), you do not need explicit approval to use this method.- Parameters:
context- the currentContextview- the button or other clickable view which should open the offer wall.
-
setOfferWallClickListener
void setOfferWallClickListener(Context context, View view, View.OnClickListener delegateClickListener) Sets a view's OnClickListener to open the offer wall when clicked. Unlike the method showOfferWall(), you do not need explicit approval to use this method.- Parameters:
context- the currentContextview- the button or other clickable view which should open the offer wall.delegateClickListener- an optional OnClickListener which will be called after the offer wall has been opened
-
setOfferWallMenuItemClickListener
Sets a menu item's OnMenuItemClickListener to open the offer wall when clicked. Unlike the method showOfferWall(), you do not need explicit approval to use this method.- Parameters:
context- the currentContextmenuItem- the menu item which should open the offer wall.
-
setOfferWallMenuItemClickListener
void setOfferWallMenuItemClickListener(Context context, MenuItem menuItem, MenuItem.OnMenuItemClickListener delegateClickListener) Sets a menu item's OnMenuItemClickListener to open the offer wall when clicked. Unlike the method showOfferWall(), you do not need explicit approval to use this method.- Parameters:
context- the currentContextmenuItem- the menu item which should open the offer wall.delegateClickListener- an optional OnMenuItemClickListener which will be called after the offer wall has been opened
-
getOfferWallButtonLabel
-
unityOfferWallButtonClick
-
wrapListAdapter
Wraps your ListAdapter in anAdListAdapter, which automatically inserts ads in your ListView.- Parameters:
context- the currentContextadapter- your own ListAdapter- Returns:
- the AdListAdapter which wraps your own adapter. In your ListView's OnItemClickListener you can use the AdListAdapter to determine the actual position of the item which was clicked, by calling AdListAdapter.getItemPosition().
-
wrapListAdapter
AdListAdapter wrapListAdapter(Context context, ListAdapter adapter, int layoutId, int iconId, int titleId, int descriptionId) Wraps your ListAdapter in anAdListAdapter, which automatically inserts ads in your ListView.- Parameters:
context- the currentContextadapter- your own ListAdapterlayoutId- the ID of your custom layout view used to display ads.iconId- the ID of an ImageView inside your custom layout, to display the ad's icon.titleId- the ID of a TextView inside your custom layout, to display the ad's title.descriptionId- the ID of a TextView inside your custom layout, to display the ad's description.- Returns:
- the AdListAdapter which wraps your own adapter. In your ListView's OnItemClickListener you can use the AdListAdapter to determine the actual position of the item which was clicked, by calling AdListAdapter.getItemPosition().
-
wrapListAdapter
AdListAdapter wrapListAdapter(Context context, ListAdapter adapter, AdListAdapter.AdLayoutCreator layoutCreator, int iconId, int titleId, int descriptionId) Wraps your ListAdapter in anAdListAdapter, which automatically inserts ads in your ListView.- Parameters:
context- the currentContextadapter- your own ListAdapterlayoutCreator- your custom implementation of AdLayoutCreator, which will be used to create the view to display ads.iconId- the ID of an ImageView inside your custom layout, to display the ad's icon.titleId- the ID of a TextView inside your custom layout, to display the ad's title.descriptionId- the ID of a TextView inside your custom layout, to display the ad's description.- Returns:
- the AdListAdapter which wraps your own adapter. In your ListView's OnItemClickListener you can use the AdListAdapter to determine the actual position of the item which was clicked, by calling AdListAdapter.getItemPosition().
-
setUserData
Report data about the user or context to the AppBrain ads system. This may increase the monetization of your app and provide you with insightful statistics in AppBrain analytics. -
tagForChildDirectedTreatment
void tagForChildDirectedTreatment(boolean tagForChildDirectedTreatment) Inform the AppBrain SDK that any subsequent requests should assume that the current user falls under the 'Child Online Privacy Protection Act' (COPPA). You don't need to explicitly set this if you marked your app as child-directed using the appbrain.child_directed property in the Android manifest.- Parameters:
tagForChildDirectedTreatment- Set this to true if the user is less than 13 years old (or for some other reason falls under the COPPA rule).
-
setPopupBorder
Adds a custom border around non-fullscreen ads.- Parameters:
color- the color of the border as ARGB int.size- the size of the border asAdService.BorderSizeenum value.
-
setReturnToAppInterstitial
Set the behavior or the user-returns-to-app interstitial. This setting will stay active until the next time you call this function. The default setting is FROM_DASHBOARD. This is useful for instance if you offer users to remove ads, then you can call setReturnToAppInterstitial(ReturnToAppConfig.OFF).- Parameters:
setting- which setting should be active until the next time you call this function.
-
InterstitialBuilder.maybeShow(Context)instead.