Android Programming Press on the image to return to the main documentation page.

iAdMob

List of types:

AdView
InterstitialAd
RewardedVideoAd

AdView


Events:

ReceiveAd
FailedToReceiveAd (ErrorCode As String)
Click
LongClick

Members:


  Alpha As Float

  BringToFront

  CalcRelativeKeyboardHeight (KeyboardHeight As Double) As Double

  Color As Int

  Height As Float

  Initialize (EventName As String, AdUnit As String, Parent As Page, AdSize As Object)

  IsFocused As Boolean [read only]

  IsInitialized As Boolean

  Left As Float

  LoadAd

  Parent As ViewWrapper [read only]

  RemoveViewFromParent

  RequestFocus As Boolean

  ResignFocus As Boolean

  SendToBack

  SetAlphaAnimated (DurationMS As Int, Alpha As Float)

  SetBorder (Width As Float, Color As Int, CornerRadius As Float)

  SetColorAnimated (DurationMS As Int, BackgroundColor As Int)

  SetLayoutAnimated (DurationMS As Int, DampingRatio As Float, Left As Float, Top As Float, Width As Float, Height As Float)

  SetParallaxEffect (Vertical As Int, Horizontal As Int)

  SetShadow (Color As Int, OffsetX As Float, OffsetY As Float, Opacity As Float, StaticRect As Boolean)

  SetTestDevices (DeviceIds As List)

  SIZE_BANNER As Object [read only]

  SIZE_FULL_BANNER As Object [read only]

  SIZE_LARGE_BANNER As Object [read only]

  SIZE_LEADERBOARD As Object [read only]

  SIZE_SMART_BANNER_LANDSCAPE As Object [read only]

  SIZE_SMART_BANNER_PORTRAIT As Object [read only]

  SizeToFit

  Tag As Object

  TintColor As Int

  Top As Float

  UserInteractionEnabled As Boolean

  Visible As Boolean

  Width As Float

Members description:

Alpha As Float
Gets or sets the view's alpha level. 0 - transparent, 1 (default) - fully opaque.
BringToFront
Brings the view to front.
CalcRelativeKeyboardHeight (KeyboardHeight As Double) As Double
Calculates the keyboard top point relative to the current view.
Color As Int
Gets or sets the view's background color.
Height As Float
Gets or sets the view's height.
Initialize (EventName As String, AdUnit As String, Parent As Page, AdSize As Object)
IsFocused As Boolean [read only]
Returns true if the view is focused.
IsInitialized As Boolean
Tests whether this object was initialized.
Left As Float
Gets or sets the view's left position.
LoadAd
Requests an ad from AdMob.
Parent As ViewWrapper [read only]
Returns the views parent. The returned view can be uninitialized (if there is no parent).
RemoveViewFromParent
Removes the view from its parent (same as B4A View.RemoveView method).
RequestFocus As Boolean
Tries to set the focus on the current view. Returns True if the focus was set. Most views are not focusable.
When a text view is focused the keyboard is shown.
ResignFocus As Boolean
Removes the focus from the current view. Removing the focus from a text view will hide the keyboard.
SendToBack
Sends the view to the back.
SetAlphaAnimated (DurationMS As Int, Alpha As Float)
Animates the view's alpha level.
DurationMS - Animation duration measured in milliseconds.
Alpha - The new alpha level (0 - transparent, 1 - fully opaque).
SetBorder (Width As Float, Color As Int, CornerRadius As Float)
Sets the view's border width, color and corner radius.
Note that the corner radius should be 0 if the view should show a shadow as well.
SetColorAnimated (DurationMS As Int, BackgroundColor As Int)
Animates the view's background color.
DurationMS - Animation duration measured in milliseconds.
BackgroundColor - The new background color.
Note that Labels do not support this type of animation.
SetLayoutAnimated (DurationMS As Int, DampingRatio As Float, Left As Float, Top As Float, Width As Float, Height As Float)
Animates the view's layout.
DurationMS - Animation duration measured in milliseconds. Set to 0 to change the layout immediately.
DampingRatio - If smaller than 1 then a spring effect will be applied to the animation. The minimum value should be 0.1.
Set to 1 for no spring effect.
Left, Top, Width and Height - The new layout.
SetParallaxEffect (Vertical As Int, Horizontal As Int)
Adds a parallax effect to the view. The view will slightly move when the device is tilted.
Vertical - Vertical offset. Can be a positive or negative value.
Horizontal - Horizontal offset. Can be a positive or negative value.
SetShadow (Color As Int, OffsetX As Float, OffsetY As Float, Opacity As Float, StaticRect As Boolean)
Adds a shadow to to the view. The border corners radius should be set to 0 when adding shadows.
Colors - The shadow color.
OffsetX, OffsetY - The horizontal and vertical offsets.
Opacity - Sets the shadow opacity: 0 - transparent, 1 - opaque.
StaticRect - (optimization parameter) Set this parameter to True if the view's size is constant.
SetTestDevices (DeviceIds As List)
Sets the test devices. Check the logs for the current device id.
SIZE_BANNER As Object [read only]
iPhone ad size (320x50)
SIZE_FULL_BANNER As Object [read only]
iPad ad size (468x60)
SIZE_LARGE_BANNER As Object [read only]
Taller version of the standard banner (320x100)
SIZE_LEADERBOARD As Object [read only]
iPad ad size (728x90)
SIZE_SMART_BANNER_LANDSCAPE As Object [read only]
SIZE_SMART_BANNER_PORTRAIT As Object [read only]
SizeToFit
Resizes the view to make it fit its content.
Tag As Object
Gets or sets the Tag object. This is a placeholder for any object you like to tie to this object.
TintColor As Int
Gets or sets the view's tint color. Some views use this color to change their appearance.
Top As Float
Gets or sets the view's top position.
UserInteractionEnabled As Boolean
Gets or sets whether the user can interact with this view. True by default.
Visible As Boolean
Gets or sets whether the view is visible.
Width As Float
Gets or sets the view's width.

InterstitialAd

This object allows you to show interstitial ads (full screen ads).
You need to request an ad by calling RequestAd and then wait for the Ready event.
If the Success parameter is true then you can call Show to show the full screen ad.
Note that you can show it whenever you like.

Events:

Ready (Success As Boolean)

Members:


  Initialize (EventName As String, AdUnit As String)

  IsReady As Boolean

  RequestAd

  SetTestDevices (DeviceIds As List)

  Show (Parent As Page)

Members description:

Initialize (EventName As String, AdUnit As String)
Initializes the interstitial ad manager.
IsReady As Boolean
Returns true if there is an interstitial ad ready to be shown.
RequestAd
Requests an interstitial ad. The Ready event will later be raised.
SetTestDevices (DeviceIds As List)
Sets the test devices. You can see the device id in the logs.
Show (Parent As Page)
Shows the ad.

RewardedVideoAd

A video ad where the user is rewarded if it is fully watched. The Rewarded event will be raised in that case.
Note that AdMob does not server these ads directly. You need to use the mediation feature to add an ad network that supports this type of ads.

Events:

ReceiveAd
FailedToReceiveAd (ErrorCode As String)
AdClosed
AdOpened
AdLeftApplication
Rewarded (Item As Object)

Members:


  Initialize (EventName As String)

  IsInitialized As Boolean

  LoadAd (AdUnitId As String)

  Ready As Boolean [read only]

  Show (Parent As Page)

  Tag As Object

Members description:

Initialize (EventName As String)
IsInitialized As Boolean
Tests whether this object was initialized.
LoadAd (AdUnitId As String)
Sends a request for an ad. The ReceiveAd event will be raised when an ad is available.
Ready As Boolean [read only]
Returns True if there is an ad ready to be displayed.
Show (Parent As Page)
Shows the video ad.
Tag As Object
Gets or sets the Tag object. This is a placeholder for any object you like to tie to this object.
Top