Android Appendix A

ADFAdSize enum

ADFAdSize Enum defines the ad units supported by the AdFalcon.

Enum Name Size Devices
AD_UNIT_AUTO_BANNER Auto Banner The server will detect the best ad unit size based on the screen size and orientation. All
AD_UNIT_320x50 Standard 320 x 50 All
AD_UNIT_300x250 Medium Rectangle 300 x 250 All
AD_UNIT_468x60 Full Banner 468 x 60 Tablet
AD_UNIT_728x90 Leaderboard 728 x 90 Tablet
AD_UNIT_120x600 Skyscraper 120 x 600 Tablet

 

ADFErrorCode enum

ADFErrorCode Enum defines AdFalcon SDK and Ad Server error codes.

Enum Description
GENERIC_SDK_ERROR Error occurred in the SDK.
INTERNAL_SERVER_ERROR Error occurred in AdFalcon server.
COMMUNICATION_ERROR SDK can not reach the AdFalcon server; mostly for issues related to the phone internet connection.
NO_AD_AVAILABLE No ad is available in the AdFalcon store that meets the ad request parameters.
INVALID_PARAM An invalid ad request parameter has been set.
MISSING_PARAM A required ad request parameter has not been set.

 

ADFListener interface

ADSListener is an interface that is used to get feedback from the AdFalcon SDK.

Method Description
public void onLoadAd(

ADFAd ad)

SDK has loaded an ad.
public void onError(

ADFAd ad,

ADFErrorCode error,

String message)

SDK has encountered an error during the loading of an ad.

Params

view: AdFalcon view

error: type of error

message: description for error

public void onPresentAdScreen(

ADFAd ad)

Ad screen is displayed.
public void onDismissAdScreen(

ADFAd ad)

Ad screen has closed.
public void onLeaveApplication() The SDK will open the ad in another application.

 

 

ADFTargetingParams class

The ADFTargetingParams Class contains all the needed parameters about any given user and application in order to help AdFalcon network to send the most relevant and targeted ad to the user. All parameters are optional

Variable Required Description Values
Language No A two-characters string parameter indicating  Ad language ar, en
Postal code No A string parameter containing the user’s postal/ZIP code

 

11121
Area code No A string parameter containing the user’s area code 06
Age No An integer parameter containing the user’s age 27
Keywords No List of keywords in comma separated format. AdFalcon’s ads selector engine will search for ads containing these keywords. ex. sport, news, lifestyle, …etc.
Gender No A parameter containing the user’s gender NONE

GENDER_MALE GENDER_FEMALE

Country code No County code of the end user in ISO 3166-1 alpha-2 format code (two-letter code)

 

JO, SA …etc.
Birthdate No Birthdate of application user in format dd.MM.yyyy  
Additional Info No A Map of keys and values to add additional parameters.  
Location: Latitude, Longitude No The geolocation information of the device. The location information is divided into two double values; latitude and longitude.

 

35.654, 34.6598

 

 

ADFView class

ADFView is the main SDK class and it is responsible for initializing, loading and rendering an ad.

Method Description
public void initialize(

String siteID, ADFAdSize adSize, ADFTargetingParams params,

ADFListener listener, boolean autorefresh

)

This is the main method in ADFView class and is used to initialize the SDK, load the first Ad and start the auto refresh timer.

You can call this method only one time.

Parameters

§   site ID: You can get this ID from AdFalcon website and it is unique for each application.

§   adSize: The size of the needed ad.

§   params: contains all the needed params to help AdFalcon network to detect and better target an Ad.

§   listener: SDK feedback.

§   autorefresh: used to enable auto refresh for ads.

public void refreshAd() Used to get a new ad.
public void setTestMode(

boolean test)

Used to inform AdFalcon network if your application is working in test or production mode.
public void setRefreshDuration(

int duration)

Determine the refresh duration in seconds among the receivedAds.
public void setEnableAutoRefresh(

boolean enable)

Used to enable/disable the auto refresh for the received ads.
public boolean  isEnableAutoRefresh() Used to know if auto refresh timer is running or paused.
public void setEnableAnimation(

                       boolean enable)

Used to Enable/Disable animation.
public boolean isEnableAnimation() Returns true if the animation is enabled otherwise disabled.
public void setListener(

ADFListener listener)

Set ADFListener.
public ADFListener getListener() Get ADFListener.
public void destroy() This method must be called either in onDestroy() method to finalize the ADFView or when you do not need to use the ADFView again.

After calling this method the SDK will kill any timer, thread or running process.

 

 

 

 

 

ADFInterstitial class

This class is responsible for creating, loading and rendering interstitial ads.

Method Description
public ADFInterstitial(

Context context,

String siteID,

ADFListener listener,

)

 

The interstitial class constructor and is responsible for initializing the interstitial ad with:

·         context

·         your site ID

·         listener

public ADFInterstitial(

Context context,

String siteID,

ADFListener listener,

                boolean testMode

)

Class constructor overload which initializes the interstitial ad with:

·         context

·         your site ID

·         listener

·         Test Mode Flag (Pass true during development only, and false for production release).

public ADFInterstitial(

Context context,

String siteID,

ADFListener listener,

ADFTargetingParams targetingParams

)

 

The interstitial class constructor and is responsible for initializing the interstitial ad with:

·         context

·         your site ID

·         listener

·         targeting parameters

public ADFInterstitial(

Context context,

String siteID,

ADFListener listener,

ADFTargetingParams targetingParams,

                boolean testMode

)

Class constructor overload which initializes the interstitial ad with:

·         context

·         your site ID

·         listener

·         targeting parameters

·         Test Mode Flag (Pass true during development only, and false for production release).

public void loadInterstitialAd() This method is used to load new interstitial ad. You can track if the ad has been loaded successfully by implementing

ADSListener.onLoadAd method.

public void showInterstitialAd() This method is used to display the interstitial in full screen mode. But you cannot call this method if the ad is not loaded successfully.

We recommended You to check isReady() method before calling it.

public boolean isReady() This method is used to check if the interstitial ad is ready to display.
public void setTestMode(

boolean testMode

)

This method is used to set test mode flag.