AdView

AdView displays advertisements by Facebook.

AdView can be declared and added to view:

AdView adView = new AdView(context, PLACEMENT_ID, AdSize.BANNER_HEIGHT_50); addView(adView); adView.loadAd();

AdView requires android.permission.INTERNET permission to make network requests. If android.permission.ACCESS_NETWORK_STATE permission is granted, AdView will only make network requests when network is connected.

الإضافات:RelativeLayout
عمليات التنفيذ:Ad
الحزمة:ads
أدوات الإنشاء
AdView(Context, String, AdSize)

Constructs an AdView using the given context, placement_id and size.

public AdView(Context context, String placementId, AdSize adSize)
المعلمةالوصف
contextAndroid context
placementIdId of ad placement
adSizeSize of the ad control
طرق المثيلات
setAdListener(AdListener)

Sets an AdListener to be notified on events in control lifecycle.

public void setAdListener(AdListener adListener)
المعلمةالوصف
adListenerThe listener
setImpressionListener(ImpressionListener)
public void setImpressionListener(ImpressionListener impListener)
المعلمةالوصف
impListenerThe listener
loadAd()

Loads an ad.

This method always returns immediately. The ad is loaded asynchronously. The control's ad listener will be called when loading finishes or fails.

public void loadAd()
loadAd()

Loads an ad.

If the AdView is configured to refresh, this will start the refreshing. There is no need to call this method multiple times.

If the AdView is not configured to refresh automatically, it can be refreshed by calling this method again. Each subsequent call should be at least 30 seconds apart.

This method always returns immediately. The ad is loaded asynchronously. If available, the ad listener will be called when loading finishes or fails.

public void loadAd()
destroy()

Destroys the ad control.

This method should be called when the hosting activity of the ad control is destroyed.

public void destroy()
destroy()
public void destroy()
getPlacementId()

Get the placementId for this ad.

public String getPlacementId()
Returns
PlacementId String representing the placementId for this ad.
getPlacementId()
public String getPlacementId()
disableAutoRefresh()

Disables auto refresh.

If the AdView is used in a mediation environment, this should be called because the mediation provider will control the refresh.

public void disableAutoRefresh()