bSupportAdMob

bSupportAdMob

#Overview

name: bSupportAdMob

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 3 C++ source files. Also referenced in 1 C# build file meaning it may affect the build system logic.

#Summary

#Usage in the C++ source code

The purpose of bSupportAdMob is to enable or disable AdMob support for advertisements in Android applications built with Unreal Engine 5. This setting is specifically related to the integration of Google’s AdMob advertising platform for mobile apps.

This setting variable is primarily used in the Android platform-specific modules of Unreal Engine 5. Based on the callsites, it’s clear that the AndroidRuntimeSettings and AndroidPlatformEditor subsystems rely on this variable.

The value of this variable is set in the AndroidRuntimeSettings class, which is likely configurable through the Unreal Engine editor’s project settings. By default, it is set to true in the constructor of UAndroidRuntimeSettings.

The bSupportAdMob variable interacts with other related variables, such as AdMobAppID. When bSupportAdMob is true, it enables the input for AdMobAppID in the editor interface.

Developers must be aware that enabling this variable will include the AdMob SDK in the project, which will be detected by the Google Play Console when uploading the APK. If the app doesn’t actually use ads, it’s recommended to disable this to avoid unnecessary warnings.

Best practices when using this variable include:

  1. Only enable it if you plan to use AdMob for advertisements in your Android app.
  2. Ensure you have a valid AdMob App ID when enabling this feature.
  3. Be aware of the implications on app size and performance when including the AdMob SDK.
  4. Consider the privacy and regulatory implications of including ad support, especially for apps targeted at children.
  5. Regularly review and update your AdMob implementation to comply with the latest Google Play policies and AdMob guidelines.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:3038, section: [/Script/AndroidRuntimeSettings.AndroidRuntimeSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Developer/Android/AndroidPlatformEditor/Private/AndroidTargetSettingsCustomization.cpp:264

Scope (from outer to inner):

file
function     void FAndroidTargetSettingsCustomization::BuildAppManifestSection

Source code excerpt:

		.EditCondition(SetupForGooglePlayAttribute, NULL);

	TSharedRef<IPropertyHandle> SupportAdMobProperty = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UAndroidRuntimeSettings, bSupportAdMob));
	GooglePlayCategory.AddProperty(SupportAdMobProperty)
		.EditCondition(SetupForGooglePlayAttribute, NULL);

	TSharedRef<IPropertyHandle> AdMobAppIDProperty = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UAndroidRuntimeSettings, AdMobAppID));
	GooglePlayCategory.AddProperty(AdMobAppIDProperty);

#Loc: <Workspace>/Engine/Source/Runtime/Android/AndroidRuntimeSettings/Classes/AndroidRuntimeSettings.h:504

Scope (from outer to inner):

file
class        class UAndroidRuntimeSettings : public UObject

Source code excerpt:

	// Enabling this includes the AdMob SDK and will be detected by Google Play Console on upload of APK.  Disable if you do not need ads to remove this warning.
	UPROPERTY(GlobalConfig, EditAnywhere, Category = GooglePlayServices, meta = (DisplayName = "Include AdMob support for ads"))
	bool bSupportAdMob;

	// AdMob Application ID
	UPROPERTY(GlobalConfig, EditAnywhere, Category = GooglePlayServices, meta = (DisplayName = "AdMob App ID"), meta = (EditCondition = "bSupportAdMob"), meta = (ToolTip = "AdMob Application ID (see https://support.google.com/admob/answer/7356431)"))
	FString AdMobAppID;

	// Admob TagForChildDirectedTreatment (see https://developers.google.com/admob/android/targeting)

#Loc: <Workspace>/Engine/Source/Runtime/Android/AndroidRuntimeSettings/Private/AndroidRuntimeSettings.cpp:27

Scope (from outer to inner):

file
function     UAndroidRuntimeSettings::UAndroidRuntimeSettings

Source code excerpt:

	, RequestCodeForPlayGamesActivities(80002)
	, bForceRefreshToken(false)
	, bSupportAdMob(true)
	, bBlockAndroidKeysOnControllers(false)
	, AudioSampleRate(44100)
	, AudioCallbackBufferFrameSize(1024)
	, AudioNumBuffersToEnqueue(4)
	, CacheSizeKB(65536)
	, MaxSampleRate(48000)

#References in C# build files

This variable is referenced in the following C# build files:

Location: <Workspace>/Engine/Source/Programs/UnrealBuildTool/Platform/Android/UEDeployAndroid.cs:2650

			Ini.GetString("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "AndroidGraphicsDebugger", out AndroidGraphicsDebugger);
			bool bSupportAdMob = true;
			Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bSupportAdMob", out bSupportAdMob);
			bool bValidateTextureFormats;
			Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bValidateTextureFormats", out bValidateTextureFormats);

			bool bBuildForES31 = false;
			Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bBuildForES31", out bBuildForES31);
			bool bSupportsVulkan = false;