d-rr / Godot-AdMob-Android-iOS

Godot's AdMob Plugin for Android (3.2.2+) and iOS (3.0+) using GitHub Actions for CI/CD. Working on Standard and Mono Godot versions.

Home Page:https://poing-studios.github.io/Godot-AdMob-Android-iOS/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build%20iOS Build%20iOS%20Mono Build%20Android Build%20Android%20Mono Copy%20admob_api%2F Export%20for%20Android%20and%20iOS

Godot AdMob for Android and iOS

This repository uses GitHub Actions, this means that whenever a new update is sent to the repository, the action will automatically test the code of the module, compile, compress the binary files and export to the "Releases tab" of the repository for the respective operational system and versions supported by the module, like v3.2.3.

Ad Formats

  • Banner
  • Interstitial
  • Rewarded
  • Unified Native (Native Ads) (ONLY Android at moment)

Is high recommended that when you use AdMob, please include it as AutoLoad and Singleton

Download example project to see how the Plugin works!

Android (v3.2.2+):

  • Download the android-template-v{{ your_godot_version }}.zip in the releases tab. STABLE VERSION and MONO VERSION
  • Enable Android Build Template. Check the tutorial here
  • Extract the content in android-template-v{{ your_godot_version }}.zip into res://android/plugins directory on your Godot project
  • On your Game Project go to:
    1. Project
      1. Export
        1. Android
          1. Options
            1. Custom Package
              • Use Custom Build
            2. Plugins
              • Ad Mob
  • Add your AdMob App ID to your app's res://android/build/AndroidManifest.xml file by adding a <meta-data> tag with name com.google.android.gms.ads.APPLICATION_ID, as shown below.
<!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data
	tools:replace="android:value"
	android:name="com.google.android.gms.ads.APPLICATION_ID"
	android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
<meta-data
	android:name="com.google.android.gms.ads.DELAY_APP_MEASUREMENT_INIT"
	android:value="true"/>

iOS (v3.0.0+):

  • Download the ios-template-v{{ your_godot_version }}.zip in the releases tab. STABLE VERSION and MONO VERSION
  • Export your game to iOS
  • Copy the library libgodot.iphone.release.fat.a you have downloaded from releases tab inside the exported Xcode project. You must delete the 'your_project_name.a' (example: AdMob.a) and rename the 'libgodot.iphone.release.fat.a' with "your_project_name.a", should be like: 'AdMob.a'.
  • Add the following frameworks to the project linking it using the "Build Phases" -> "Link Binary with Libraries" option:
    • Extract the following .framework from googlemobileadssdkios.zip:
      • GoogleAppMeasurement.framework
      • GoogleMobileAds.framework
      • GoogleUtilities.xcframework
      • nanopb.xcframework
      • PromisesObjC.xcframework
      • UserMessagingPlatform.xcframework
    • These frameworks are already in your computer
      • AppTrackingTransparency | Status: (Optional) (if not appear: need to update XCode or SDK version to iOS 14.0)
      • AdSupport | Status: (Optional)
      • JavaScriptCore
  • Add the -ObjC linker flag to Other Linker Flags in your project's build settings: -ObjC
  • Update your GAMENAME-Info.plist file, add a GADApplicationIdentifier key with a string value of your AdMob app ID: plist
  • Enable SKAdNetwork to track conversions: SKAdNetwork
  • Request App Tracking Transparency authorization RequestAuthorization
  • (Optional) If you are using UMP, you can add too the Delay app measurement DelayAppMeasurement

User Messaging Platform (UMP):

  • To use UMP due of EUROPE ePrivacy Directive and the General Data Protection Regulation (GDPR), you first need to do configure your Funding Choices.
  • If your app is "ForChildDirectedTreatment" then the UMP won't appear and signals won't work for consent, this is normal so don't worry.
  • To show personalized or non-personalized ads, then you need to change inside your AdMob Account npa-image

API References

Signals:

initialization_complete(status, adapter_name) #when AdMob initializes, can be enum NOT_READY(0) or READY(1)

banner_loaded() #ad finishes loading
banner_destroyed() #banner view is destroyed
banner_failed_to_load(error_code : int) #ad request fails
banner_opened() #ad opens an overlay that
banner_left_application() #user has left the app
banner_closed() # user is about to return to the app after tapping on an ad

interstitial_loaded() #ad finishes loading
interstitial_failed_to_load(error_code : int) #ad request fails
interstitial_opened() #ad is displayed
interstitial_left_application() #user has left the app
interstitial_closed() #interstitial ad is closed

rewarded_ad_loaded() #ad successfully loaded
rewarded_ad_failed_to_load() #ad failed to load
rewarded_ad_opened() #ad is displayed
rewarded_ad_closed() #ad is closed
rewarded_user_earned_rewarded(currency : String, amount : int) #user earner rewarded
rewarded_ad_failed_to_show(error_code) #ad request fails

unified_native_loaded() #unified native loaded and shows the ad
unified_native_destroyed() #unified native view destroyed
unified_native_failed_to_load(error_code : int) #ad request fails

unified_native_opened() #ad opens an overlay that
unified_native_closed() #user is about to return to the app after tapping on an ad

consent_form_dismissed() #then the consent is REQUIRED(user in EEA or UK) and user dismissed the form
consent_status_changed(consent_status_message) #get the ConsentStatus
consent_form_load_failure(error_code, error_message) #get the code and message of error to see why form is not loading
consent_info_update_success() #consent information state was updated
consent_info_update_failure(error_code, error_message) #get the code and message of error to see why info update consent fail

Methods

#Private
#-----------------
_initialize() #init the AdMob
_on_AdMob_*() #just to emit signals

#Public
#-----------------
load_banner() #load the banner will make him appear instantly
load_interstitial() #loads the interstitial and make ready for show
load_rewarded() #loads the rewarded and make ready for show
load_unified_native(control_node_to_be_replaced : Control = Control.new()) #load the unified native will make him appear instantly (unified native and banner are View in Android and iOS, it is recommended to only use one of them at a time, if you try to use both, the module will not allow it, it will remove the older view

show_interstitial() #shows interstitial
show_rewarded() #shows rewarded

destroy_banner() #completely destroys the Banner View
destroy_unified_native() #completely destroys the Unified Native View

About

Godot's AdMob Plugin for Android (3.2.2+) and iOS (3.0+) using GitHub Actions for CI/CD. Working on Standard and Mono Godot versions.

https://poing-studios.github.io/Godot-AdMob-Android-iOS/

License:MIT License


Languages

Language:Java 36.5%Language:Objective-C++ 29.6%Language:GDScript 28.7%Language:Objective-C 4.1%Language:Python 0.7%Language:C++ 0.5%