Provides all available methods for earning revenue through App recommendations. More...
Public Member Functions | |
| boolean | isLaunchCanvasOnBannerClicked () |
| Deprecated. Use isLaunchCatalogOnBannerClicked() instead. | |
| boolean | isLaunchCatalogOnBannerClicked () |
Returns true if the option to launch the catalog on click is enabled. | |
| View | getHook (Context context, String hookName, int mode) |
| Get a banner to display. | |
| void | openCatalog (Context context) |
| Deprecated. Use openCatalog(Context, String) instead. | |
| void | openCatalog (Context context, String hookName) |
| Open a catalog View for the given hook which will display ads. | |
| boolean | hasAds () |
Returns true if ads are downloaded, parsed and available for use in getOffer(String), getHook(Context, String, int) or openCatalog(Context, String). | |
| void | addUserCookie (String key, String value) |
| Set a key/value pair ("UserCookie") which will be trasmitted to the Flurry servers when an offer is accepted. | |
| void | clearUserCookies () |
| Clear the UserCookies Map. | |
AppCircle Configuration | |
Optional config options for AppCircle | |
| void | setDefaultNoAdsMessage (String message) |
| Set a default message to display when no ads are available. | |
| void | setAppCircleCallback (AppCircleCallback callback) |
| Set the AppCircleCallback listener. | |
| void | launchCatalogOnBannerClicked (boolean flag) |
| Sets whether or not a banner should launch the catalog on a click or go directly to the Market. | |
| void | launchCanvasOnBannerClicked (boolean flag) |
| Deprecated. Use launchCatalogOnBannerClicked(boolean) instead. | |
Custom Offers | |
Methods for creating and working with custom offers | |
| Offer | getOffer (String hookName) |
| Get an Offer object for the specified hook. | |
| List< Offer > | getAllOffers (String hookName) |
| Get a list of all the Offers available for the given hook. | |
| void | acceptOffer (Context context, long offerId) |
| Accept an Offer, sending the User Cookie (if specified) to Flurry and the device to the Market for the selected Offer. | |
| void | removeOffers (List< Long > offerIds) |
| Offer | getOffer () |
| Deprecated. Use getOffer(String) instead. | |
| List< Offer > | getAllOffers () |
| Deprecated. Use getAllOffers(String) instead. | |
Provides all available methods for earning revenue through App recommendations.
Set of methods that allow developers to leverage the Flurry ad network to earn revenue through App recommendations.
| void acceptOffer | ( | Context | context, |
| long | offerId | ||
| ) |
Accept an Offer, sending the User Cookie (if specified) to Flurry and the device to the Market for the selected Offer.
public void acceptOffer(Offer offer, String reward){ appCircle.clearUserCookies(); appCircle.addUserCookie(kRewardCookieName, reward); try{ final long offerId = offer.getId(); appCircle.acceptOffer(this, offerId); FlurryAgent.logEvent("Accepted Offer", new HashMap<String, String>() {{put("offerId", "" + offerId);}}); } catch(Throwable t) { t.printStackTrace(); } }
| context | The Context of the Activity from which this action will occur. |
| offerId | The id of the Offer which is being accepted. |
| void addUserCookie | ( | String | key, |
| String | value | ||
| ) |
Set a key/value pair ("UserCookie") which will be trasmitted to the Flurry servers when an offer is accepted.
UserCookies are used largely to transmit data surrounding incentivized installs, though they can be used for other purposes. There is one UserCookie object, and on each offer acceptance (whether via a banner click, a catalog click, or an acceptOffer call) that UserCookie is transmitted to the Flurry servers. The UserCookie key/value pairs will be transmitted back to the developer via the app callback if one is set. See the wiki for more details on the entire process.
| key | The key, as a String. |
| value | The value, as a String. |
| void clearUserCookies | ( | ) |
Clear the UserCookies Map.
| List<Offer> getAllOffers | ( | String | hookName | ) |
Get a list of all the Offers available for the given hook.
getAllOffers(String) will return a List which contains each offer available for the specified hook.
| hookName | The name of the hook from which the Offers will be pulled. |
| View getHook | ( | Context | context, |
| String | hookName, | ||
| int | mode | ||
| ) |
Get a banner to display.
Get a View which contains a banner which can be displayed in the current context's view.
private void showBanner() { // Check if there are ads first. If there are, display them. if(FlurryAgent.getAppCircle().hasAds()){ View view = FlurryAgent.getAppCircle().getHook(this, kDefaultHook, Constants.MODE_PORTRAIT); if (view != null) { ViewGroup viewGroup = (ViewGroup) findViewById(R.id.mainView); viewGroup.addView(view); } } }
| context | The context of the Activity in which the request is being made. |
| hookName | The name of the hook which the ads should be pulled from. |
| mode | The display mode, which can correspond to Constants.MODE_PORTRAIT or Constants.MODE_LANDSCAPE. |
| Offer getOffer | ( | String | hookName | ) |
Get an Offer object for the specified hook.
Offer objects can be used when the developer wishes to construct their own custom offer. Each call to getOffer(String) will cycle through the Offers which have been downloaded and not yet accepted. Once an offer is accepted, it will be taken out of rotation.
// Get an offer Offer offer = FlurryAgent.getAppCircle().getOffer(fHookName); // where fHookName is some predefined String // Accept the offer, which can be done after the user clicks on the constructed custom ad try{ final long offerId = offer.getId(); FlurryAgent.getAppCircle().acceptOffer(this, offerId); FlurryAgent.logEvent("Accepted Offer", new HashMap<String, String>() {{put("offerId", "" + offerId);}}); } catch(Throwable t) { t.printStackTrace(); }
| hookName | The name of the hook from which to pull the offers. |
| boolean hasAds | ( | ) |
Returns true if ads are downloaded, parsed and available for use in getOffer(String), getHook(Context, String, int) or openCatalog(Context, String).
If AppCircle is enabled, when the app is brought to the foreground, the SDK will attempt to download and parse offers. Only after the offers have been downloaded and parsed will hasAds return true.
false result, as the offers may not have been completely downloaded or parsed.true.true if ads are available, or false otherwise. | boolean isLaunchCatalogOnBannerClicked | ( | ) |
Returns true if the option to launch the catalog on click is enabled.
true if the option to launch the catalog on ad click is enabled. | void launchCatalogOnBannerClicked | ( | boolean | flag | ) |
Sets whether or not a banner should launch the catalog on a click or go directly to the Market.
When a banner is clicked, it is possible to launch the canvas page in between the click and the trip to the Market. The catalog page presents more information about app, as well as a list of other recommended apps.
| flag | true to launch catalog on click, or false otherwise |
| void openCatalog | ( | Context | context, |
| String | hookName | ||
| ) |
Open a catalog View for the given hook which will display ads.
| context | The Context of the Activity in which the Catalog will be displayed. |
| hookName | The hook name which the ads should be pulled from. |
| void removeOffers | ( | List< Long > | offerIds | ) |
Remove the Offers with the given IDs from the cache of offers.
| offerIds | A List of Offer IDs to remove. |
| void setAppCircleCallback | ( | AppCircleCallback | callback | ) |
Set the AppCircleCallback listener.
The AppCircleCallback will be notified when Offers are available for use from the SDK. This can be used when it is important to be notified immediately when Offers are ready for display.
| callback | The implementor of AppCircleCallback. |
| void setDefaultNoAdsMessage | ( | String | message | ) |
Set a default message to display when no ads are available.
| message | The message to display when no ads are available. |