AppCircle Class Reference

Provides all available methods for earning revenue through App recommendations. More...

List of all members.

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.

Detailed Description

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.

Author:
2010 - 2011 Flurry, Inc. All Rights Reserved.
Note:
For additional information on how to use Flurry's AppCircle SDK to attract high-quality users and monetize your user base see Support Center - AppCircle.

Member Function Documentation

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();
            }
        }
See also:
addUserCookie(String, String) clearUserCookies for more information on working with user cookies.
Parameters:
contextThe Context of the Activity from which this action will occur.
offerIdThe 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.

See also:
acceptOffer for code samples involving using addUserCookie
clearUserCookies
Parameters:
keyThe key, as a String.
valueThe value, as a String.
void clearUserCookies ( )

Clear the UserCookies Map.

See also:
addUserCookie(String, String) for more details on working with UserCookies.
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.

See also:
getOffer(String) for more information on working with individual Offers.
Parameters:
hookNameThe name of the hook from which the Offers will be pulled.
Returns:
A List of Offers.
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.

Note:
It is important to note that getting the banner is dependent on the availability of offers in the Flurry SDK. When AppCircle is enabled, the SDK will download and parse a set number of offers (controlled server side) upon application foregrounding. Requests to getHook before these ads are downloaded and parsed will result in no banners being available. There are two methods for determining if offers are available, making a call to hasAds or setting up an AppCircleCallback listener.
See also:
hasAds
setAppCircleCallback(AppCircleCallback)
        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);
                }
            }
        }
Parameters:
contextThe context of the Activity in which the request is being made.
hookNameThe name of the hook which the ads should be pulled from.
modeThe display mode, which can correspond to Constants.MODE_PORTRAIT or Constants.MODE_LANDSCAPE.
Returns:
The View which contains the banner.
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();
        }
See also:
acceptOffer(Context, long) for details on accepting offers with incentivization
getAllOffers(String) for details on working with multiple offers at one time
Parameters:
hookNameThe name of the hook from which to pull the offers.
Returns:
The selected Offer.
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.

Note:
Calling hasAds directly upon app launch will often result a false result, as the offers may not have been completely downloaded or parsed.
In the circumstance that multiple hooks are present, offers being downloaded and parsed for only one of those hooks will result in hasAds returning true.
Returns:
true if ads are available, or false otherwise.
boolean isLaunchCatalogOnBannerClicked ( )

Returns true if the option to launch the catalog on click is enabled.

See also:
launchCatalogOnBannerClicked(boolean) for more information on the catalog.
Returns:
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.

Parameters:
flagtrue 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.

See also:
openCatalog(Context)
Note:
Does not currently support incentivization.
Parameters:
contextThe Context of the Activity in which the Catalog will be displayed.
hookNameThe 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.

Parameters:
offerIdsA 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.

See also:
AppCircleCallback for more details.
Parameters:
callbackThe implementor of AppCircleCallback.
void setDefaultNoAdsMessage ( String  message)

Set a default message to display when no ads are available.

Parameters:
messageThe message to display when no ads are available.

The documentation for this class was generated from the following file: