Admob Interstitial
-
Description
Admob Intersticial
The Admob Interstitial component allows to place ads in your application. Interstitial are full-screen ads that cover the interface of your application. They are usually displayed at natural transition points in the flow of an application, such as between activities or during the break between levels in a game. When an application shows an interstitial ad, the user has the option to see the ad or close it and return to the application.
In order to use Admob we must create an account. It will also be helpful to know how to configure Admob for our application. -
Events
- When loading the ad
- Event that will be executed when the ad finishes loading.
- Failed to load the ad
- This event will be executed when the ad request fails. East
Event comes with predefined error codes.
Possible values are defined as constants in the AdRequest class:
- ERROR_CODE_INTERNAL_ERROR: Something happened internally; for example, it received an invalid response from the ad server.
- ERROR_CODE_INVALID_REQUEST: The ad request is not valid; by For example, the ID of the ad unit was incorrect.
- ERROR_CODE_NETWORK_ERROR: The ad request was not successful due to the network connectivity.
- ERROR_CODE_NO_FILL: The ad request was successful, but was not returned No ad due to lack of ad inventory.
- When the ad is shown
- Event that will run when the ad is displayed and cover the screen Of the device.
- When leaving the application
- This event is invoked when a user clicks on another application (like Google Play), creating a background of the current application.
- When closing the ad
- This event is invoked when the interstitial ad is closed due to that the user touches the close icon or uses the Back button.
-
Procedures
- Upload ad
- This method allows us to upload our ad. For this to work there is that add the unique id or with the property 'Add unique id' or from the properties of the interstitial Admob component.
- Show ad
- This method shows our ad on the screen.
-
Properties
- Add unique Id
- Specify the unique identifier for the ad unit interstitial This id is better put in the properties of the component, but with this block of ownership we can change that id dynamically.
- Test mode
- Specifies whether you are in test mode or not. If we set the value to True, we will be indicating that we are in test mode and vice versa. This allows You can have a production ID set but when you activate test mode, the ads that will be shown will be tested.
-
Example
- Adding Interstitial Admob
- Unlike the banner, we must first use the procedure 'Upload ad' and once it has been loaded, it will activate the 'When loading the ad' event and there we place the 'Show ad' procedure, allowing the ad to have time to load correctly, and then visualize it. We must remember that we have to put the unique id for our ad, either in the properties of the component or with the block 'Add unique id'.
And voila, our interstitial announcement will appear in the screen.