Monetizing your app with AdMob | Aquro Help Center

Intro

AdMob is a mobile ad platform provided by Google. Using AdMob ads in your app can be an easy way to monetize on your app without selling it as a paid app or using micro-transactions. 

Setting up an AdMob account requires a few different steps, but once setup it is very easy to implement into your app.

 

Setting up AdMob

  1. Creating a AdMob account (if you do not already have one)
  2. Creating AD Units 
  3. Configuring your app for using ads

 

Step 1 - Creating a AdMob account

If you already have an AdMob account, please continue with step 2. 

  1. Go to www.admob.com
  2. Click on Sign up
  3. Follow the instructions and create an account

 

Step 2 - Creating Ad Units

Once you have your AdMob account set up, you are ready to create Ad Units. An Ad Unit can be either a banner or a fullscreen (Interstitial) ad that will play a movie. 

You can choose if you would like to use either or both.

One Ad Unit for each format has to be created for each platform your app will run on (iOS / Android).

Create these Ad-Units via these steps:

  1. Click on MONETIZE in the top menu
  2. Click on MONETIZE NEW APP in the left menu
  3. Click ADD YOUR APP MANUALLY
  4. Type in the name of your app
  5. Select Android as platform
  6. Click ADD APP
  7. Click on BANNER
  8. Type in "Android-Banner" as Ad Unit name
  9. Click SAVE
  10. On the question about linking to FireBase, click SKIP
  11. Click CREATE ANOTHER AD UNIT
  12. Click on INTERSTITIAL
  13. Type in "Android-Interstitial" as Ad unit name
  14. Click SAVE
  15. Click DONE

 

You will now see a list of your two ad units, the ID for these ad units will later be used when you are implementing ads in your app, so copy them somewhere and save them. 

Repeat all of the above steps for your iOS app as well. 

 

Step 3 - Configuring your app for using ads:

Once you have generated Ad units for your ads, you are now ready to implement these ads in your app. This is done by first initializing the AdMob settings by using the Device.AdMob.Init coding block and then show the banner by using the Device.AdMob.Banner.Create or by showing an interstitial ad by using the Device.AdMob.Interstitial.LoadAndShow.

 

First, initialize your AdMob by using the Device.AdMob.Init coding block by editing the Loaded-script on your MasterPage. Do this by following these steps:

  1. Open the MasterPage
  2. Click on SCRIPTS
  3. Click on Edit Visual Coding
  4. Add Device.AdMob.Init to your script. 
  5. And configure the Device.AdMob.Init block with the the four different ad unit ids we previously created.

 

When that is done, save your MasterPage and you are ready to start using ads.

To show a banner in your app, use the Device.AdMob.Banner.Create coding block to show an interstitial ad by using the Device.AdMob.Interstitial.LoadAndShow

Please note that after you've added ads to your app - it might take a few hours before they start to show up. If you would like to test that the ads you can set 'Yes' as value to the TestMode parameter which will will show test ads in your app. Do not forget to change this back after you are done testing.


Visual Coding Blocks 

The following Visual Coding blocks can be used to use manage ads in your app:

 

Device.AdMob.Banner.Create
Creates a banner view where the banner will be shown. The bannerview will be created in the bottom of the page. If you would like the banner to be shown in the top of your page instead, please have a look at the documentation for the Device.AdMob.Init block.

Parameters:
None

Return values:
ErrorMessage (Value) - Error if something went wrong

Outlets:
Done - Called when the block is done
Failed - Called if something went wrong

 

Device.AdMob.Banner.Hide
Temporarily hides the banner from the app.

Parameters:
None

Return values:
ErrorMessage (Value) - Error if something went wrong

Outlets:
Done - Called when the block is done
Failed - Called if something went wrong

 

Device.AdMob.Banner.Remove
Removes the banner view from the app. To view the banner again, use the Device.AdMob.Banner.Create block

Parameters:
None

Return values:
ErrorMessage (Value) - Error if something went wrong

Outlets:
Done - Called when the block is done
Failed - Called if something went wrong

Device.AdMob.Banner.Init
Initilizes the admob features. This must be run before using AdMob.

Parameters:
Android_BannerId (Value) - Ad-unit ID for the Android banner format
Android_InterstitialId (Value) - Ad-unit ID for the Android interstitial format
iOS_BannerId (Value) - Ad-unit ID for the iOS banner format
iOS_InterstitialId (Value) - Ad-unit ID for the iOS interstitial format
TestMode (Value) - Set to Yes to use testing ads
BannerPosition (Value) - Set to Top to get the banner on the top of the window, all other values will put the banner in the bottom.

Return values:
ErrorMessage (Value) - Error if something went wrong

Outlets:
Done - Called when the block is done
Failed - Called if something went wrong

 

Implementing via JavaScript and advanced usage:

You can always use your own custom JavaScript code to work with the AdMob library.

Aquro is using the cordova-plugin-admob-free Cordova plugin for this device feature. 

More documentation and code examples for this plugin can be found here:
https://github.com/ratson/cordova-plugin-admob-free