Skip to content
  • English
  • Polski
Digital Karabela
Digital Karabela
Primary Navigation Menu
Menu
  • Home
  • Products
  • DevBlog
  • Castle Engine
  • About

Updates in Castle Game Engine Admob Service

Castle Game Engine Logo

Castle Game Engine has many, easy to use integrations with services for mobile games. While I’m working on my Android game, I’ve made many improvements to the Admob module.

Required App ID

Starting from version 17 of the Ads SDK, Admob requires the application ID (App ID) in AndroidManifest.xml. In the case of CGE engine, this identifier is set in CastleEngineManifest.xml:

<service name="admob">
    <parameter key="app_id" value="..."/>
</service>

You can use the ca-app-pub-3940256099942544~3347511713 ID for testing. Remember that using this service requires also google_play_services.

Rewarded ads

The module supports now rewarded ads. To use them, just set new RewardedUnitId parameter in TAds.InitializeAdMob:

procedure TAds.InitializeAdMob(const BannerUnitId, InterstitialUnitId,
RewardedUnitId: string; const TestDeviceIds: array of string);

If you don’t want to use some form of advertising e.g. interstitial, you can use an empty string in InitializeAdMob procedure. To display a rewarded advertisement, simply use the ShowFullScreen procedure with the atReward ad type:

CGEAds.ShowFullScreenAd(anAdMob, atReward, true);

More accurate result in TAdClosedEvent

The TAdClosedEvent event has been rebuilt, the Watched parameter has now TAdWatchStatus type instead of Boolean. Possible values and their meaning are given in the table below:

TAdWatchStatus AdMob errorCode equivalent Description
wsWatched – The ad was displayed.
wsUnknownError ERROR_CODE_INTERNAL_ERROR Ad mob internal error or unknown error code.
wsNetworkNotAvailable ERROR_CODE_NETWORK_ERROR No internet connection.
wsNoAdsAvailable ERROR_CODE_NO_FILL No ads available.
wsUserAborted – Rewarded ad aborted by user.
wsAdNotReady – The ad is still loading (when we don’t want to wait).
wsAdNetworkNotInitialized – Ad network not initialized or request for uninitialized ad type.
wsInvalidRequest ERROR_CODE_INVALID_REQUEST Invalid Request – bad Unit ID for example.
wsApplicationReinitialized – Java application was killed, but native code survived, while waiting for ad to finish.

Debug

If you want more logs, change the value of the ServiceAdMob.debug from false to true. Service source file is located in: tools/build-tool/data/android/integrated-services/admob/app/src/main/java/net/sourceforge/castleengine/ServiceAdMob.java

How to get it?

The changes have been merged and are available in the master branch on github.

2019-07-25
Previous Post: Castle Game Engine stable 6.4 or beta 6.5 which version to use?
Next Post: ASTC compression support added to Castle Game Engine

Try my new game! Free to play!

Logo Bricks Color Pick

Bricks Color Pick is a completely new approach to classic Arkanoid! No paddle! Now your goal is to switch the color of the ball to the color of the brick.

Get it from Google Play

Level 37/40 5-6 Colors Screenshot

You can also change ball movement direction by the button in top left corner.

QR Code Google Play Bricks Color Pick

Level 62/80 (RelaxMode) Screenshot

Recent Posts

  • How to compile OpenAL library for Android with Oboe library.
  • Lazarus 2.0.12 Released
  • How to Fix LMMS GUI Freezing on Linux?
  • How to update wine to 5.0.0 on Linux Mint 19 or Ubuntu 18?
  • Agile Commander 1.2.3 Released!

Categories

  • DevBlog
  • GameDev
    • Castle Game Engine
    • Godot Engine
  • Linux
  • Programming
    • Dlang
      • DlangUI
    • Object Pascal
      • Lazarus
  • Promotion

Products:
Agile Commander
Bricks Color Pick

 

 

Digital Karabela – Andrzej Kilijański
76-015 Wyszebórz 32, Poland
https://digitalkarabela.com
Contact
Privacy Policy