com.sec.android.ad
Class AdHubView

java.lang.Object
  extended by RelativeLayout
      extended by com.sec.android.ad.AdHubView
All Implemented Interfaces:
com.sec.android.ad.UserInterface

public final class AdHubView
extends RelativeLayout
implements com.sec.android.ad.UserInterface

The AdHubView class is a base class to obtain an Ad. It can be included in the Layout of the application.

* Features


Ad is refreshed automatically by other Ads with a fixed refresh rate that can be configured. (setRefreshRate(int)) (setRefreshRate(int))
Call startAd() to obtain an Ad, and call stopAd() to cancel the process of obtaining an Ad. The two methods can be called alternately, depending on the scenario. When an Ad is displayed on the screen and obtaining the next Ad fails, the existing Ad remains unchanged.

Version:
v2.0.0

Field Summary
 
Fields inherited from interface com.sec.android.ad.UserInterface
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AdHubView(Context context)
           
AdHubView(Context context, AttributeSet attrs)
           
AdHubView(Context context, AttributeSet attrs, int defStyle)
          Deprecated. 
AdHubView(Context context, java.lang.String inventoryID, AdSize adSize)
           
 
Method Summary
 int getRefreshRate()
          Gets the currently configured Ad refresh rate.
 int getThreadPriority()
          Returns the priority of the thread.
 boolean hasAdContent()
          Checks whether it has a Banner Ad (AdHubView).
 void init(Context context, java.lang.String inventoryID, AdSize adSize)
          This initializes the AdHubView.
 void setGeoCoder()
          Sets the GeoCoder from location.
 void setListener(AdNotificationListener listener)
          Sets the Listener.
 void setLocation(double latitude, double longitude)
          Sets the location.
 void setLocation(double latitude, double longitude, double altitude)
          Sets the location.
 void setProgressBarVisibility(boolean visible)
          Deprecated. 
 void setRefreshRate(int milliseconds)
          Updates the Ad refresh period.
 void setTextAdBackgroundGradient(int top, int bottom)
          Deprecated. 
 void setTextAdTextColor(int color)
          Deprecated. 
 void setThreadPriority(int priority)
          Sets the priority of the thread.
 void setUserProfile(UserProfile profile)
          Registers UserProfile.
 void startAd()
          Request an Ad from the server.
 void stopAd()
          Cancels the Ad request.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdHubView

public AdHubView(Context context,
                 java.lang.String inventoryID,
                 AdSize adSize)

AdHubView

public AdHubView(Context context)

AdHubView

public AdHubView(Context context,
                 AttributeSet attrs)

AdHubView

@Deprecated
public AdHubView(Context context,
                            AttributeSet attrs,
                            int defStyle)
Deprecated. 

Method Detail

init

public void init(Context context,
                 java.lang.String inventoryID,
                 AdSize adSize)
This initializes the AdHubView.

Parameters:
context - Context
inventoryID - ID of Ad Inventory, which is issued in the SamsungAdHub website.
adSize - size of Ad. Refer to AdSize

setListener

public void setListener(AdNotificationListener listener)
Sets the Listener. Notifications for onAdReceived or onAdFailed can be received through AdNotificationListener.

Parameters:
listener - AdNotificationListener

setRefreshRate

public void setRefreshRate(int milliseconds)
Updates the Ad refresh period. The minimum value for the refresh rate is 12 seconds. If the entered value is less that 12 seconds or setRefreshRate() is not called, the refresh rate is set to 30 seconds.

Parameters:
milliseconds - Ad refresh period (unit: milliseconds). Minimum value is 12 seconds and any values smaller than that are ignored. Range: milliseconds >= 12*1000

getRefreshRate

public int getRefreshRate()
Gets the currently configured Ad refresh rate.

Returns:
Ad refresh rate, Range: rate >= 12*1000

hasAdContent

public boolean hasAdContent()
Checks whether it has a Banner Ad (AdHubView). Having an Ad means that it has data to display on the screen, which has nothing to do with the visibility setting through View.setVisibility(int).

Returns:
true if it has an Ad and false if not.

stopAd

public void stopAd()
Cancels the Ad request. No action is taken until startAd() is called again.


startAd

public void startAd()
Request an Ad from the server. This method requests an Ad immediately before the Ad is displayed on the screen for the first time. Ads are requested at fixed time intervals for subsequent calls.

Specified by:
startAd in interface com.sec.android.ad.UserInterface

setUserProfile

public void setUserProfile(UserProfile profile)
Registers UserProfile.

Specified by:
setUserProfile in interface com.sec.android.ad.UserInterface
Parameters:
profile - information such as age, gender, interests, etc.

setGeoCoder

public void setGeoCoder()
Sets the GeoCoder from location. You can call this after running SetLocation.

Specified by:
setGeoCoder in interface com.sec.android.ad.UserInterface

setLocation

public void setLocation(double latitude,
                        double longitude,
                        double altitude)
Sets the location. Check the LocationManager in the Android Platform SDK for the method to obtain data to set in the location field.

Specified by:
setLocation in interface com.sec.android.ad.UserInterface
Parameters:
latitude - latitude, range: -90 ~ 90
longitude - longitude, range: -180 ~ 180
altitude - altitude, range: Double

setLocation

public void setLocation(double latitude,
                        double longitude)
Sets the location. Check the LocationManager in the Android Platform SDK for the method to obtain data to set in the location field.

Specified by:
setLocation in interface com.sec.android.ad.UserInterface
Parameters:
latitude - latitude, range: -90 ~ 90
longitude - longitude, range: -180 ~ 180

setThreadPriority

public void setThreadPriority(int priority)
Sets the priority of the thread.

Specified by:
setThreadPriority in interface com.sec.android.ad.UserInterface
Parameters:
priority - The new thread priority setting. It must be less than AdHubView.MAX_PRIORITY(10) and greater than AdHubView.MIN_PRIORITY(1). The default value is AdHubView.NORM_PRIORITY(5).

getThreadPriority

public final int getThreadPriority()
Returns the priority of the thread.

Specified by:
getThreadPriority in interface com.sec.android.ad.UserInterface
Returns:
The priority of the thread.

setProgressBarVisibility

@Deprecated
public void setProgressBarVisibility(boolean visible)
Deprecated. 


setTextAdTextColor

@Deprecated
public void setTextAdTextColor(int color)
Deprecated. 


setTextAdBackgroundGradient

@Deprecated
public void setTextAdBackgroundGradient(int top,
                                                   int bottom)
Deprecated.