1C:Enterprise mobile platform enables displaying advertisement information in your mobile applications. If there is a need to display ads, the application developer can configure displaying advertisement banners in the mobile application via the Google AdMob service (https://www.google.com/admob/). The service is available for mobile devices that run on the Android and iOS operating systems.
Once configured for a mobile application in the service, the add is displayed as a special ad unit in textual or graphical format. The unit can be displayed in full-screen mode (full-screen or interstitial unit) or in a predefined part of a mobile device's screen (banner unit).
This article only considers technical aspects of how a mobile application works with this service.
The general arrangement of working with ads is as follows:
1. Register your mobile application in the service.
2. If it is necessary, configure ad units in the service.
3. Implement the API for working with ads, by using the data you obtained at previous steps.
By default, once the mobile application is started, the system has the following settings:
Advertisement is not used in the mobile application.
Full-screen ad unit ID is not specified.
Banner ad unit ID is not specified.
Advertisement is not displayed on the application's screen.
To control displaying the advertisement information, use the AdRepresentation global context property.
To make ads display in the application, ensure that all the following conditions are met:
Ad usage in the mobile application is enabled via the AdRepresentation.SetUsing(True) method.
Ad unit displaying mode is specified via the AdRepresentation.SetAdBannerRepresentation() method.
The method affects only banner ad units.
If you use the Google AdMob service, then the ad unit ID is specified via the AdRepresentation.SetAdBannerID() method.
If the mobile application uses a full-screen ad, then its displaying is performed via the AdRepresentation.ShowFullScreenAd() method. Place a call to the method exactly where you want to display the full-screen ad.
In this instance, if you use the Google AdMob service, you should preliminarily specify the full-screen ad unit ID via the AdRepresentation.SetFullScreenAdID() method.
Note that it is the ad network that provides ad rotation in your mobile application.
When using the Google AdMob service, when specifying ad unit IDs, use the IDs you obtained via the web interface of the service.
Configuring Google AdMob ads
IMPORTANT! The description of working with the web interface is valid at the document creation time.
1. Sign up for the Google AdMob service.
2. Sign in to the Google AdMob service on behalf of your user account (https://apps.admob.com).
3. Start monetizing your mobile application. To do this, on the main menu, click Apps, and then click Add your first app.
4. Find your application by its name and open its page.
5. Click Add ad unit.
6. Select an appropriate ad format: banner or interstitial (full-screen), specify the name for the ad unit, and then click Create ad unit.
7. Save the value of the resulting ad unit ID property.
8. Click Done.
9. For an Android-platform application, specify ad unit IDs in appropriate places of your mobile application's code as input parameters of the AdRepresentation.SetAdBannerID() and AdRepresentation.SetFullScreenAdID() methods correspondingly.
Testing Google AdMob ads
The general arrangement of testing ads provided via the Google AdMob service is as follows:
For testing whether the application displays ads:
Publishing the mobile application in the app store is not required.
Only IDs of ad units registered for the application in the Google AdMob service are required.
When you run your application on the developer's 1C:Enterprise mobile platform, the application's ad units display test contents.
After you build the application via the mobile application builder and then run the application, it starts displaying the actual advertisement information.