You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description - The onAdLoaded callback in react-native-google-mobile-ads does not behave consistently on Android. While it triggers with a slight delay on iOS (1-2 seconds or milliseconds), it never gets triggered in certain instances on Android. This inconsistency makes it difficult to manage states like loading indicators reliably.
P.S: We are using Banner Ads and FLUID.
Platform
• Android: onAdLoaded is unreliable and sometimes does not trigger.
• iOS: onAdLoaded works, albeit with a slight delay.
Steps to Reproduce
1. Implement a GAMBannerAd component with the onAdLoaded callback.
2. Use the following configuration for the ad:
- Ad unit ID: /3865/ddm.people.app(any id can be used)
- Sizes: ['FLUID', '300x250', '300x600']
Example : <GAMBannerAd requestOptions={{ networkExtras: {}, customTargeting: { type: 'app', slot: props.id, sceneIndex:${props.activeIndex}, frameWidth: ${adWidth}, frameHeight: ${adHeight}, }, }} unitId={adUnitId} sizes={sizes} onAdFailedToLoad={() => console.log('Ad failed to load')} onAdLoaded={handleAdLoaded} />
3. Test the ad on both Android and iOS devices.
Platforms
Only on Android
React Native Info
info Fetching system and libraries information...
System:
OS: macOS 15.2
CPU: (8) arm64 Apple M1
Memory: 317.58 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.18.1
path: ~/.nvm/versions/node/v20.18.1/bin/node
Yarn:
version: 1.22.22
path: ~/people-moonshot/node_modules/.bin/yarn
npm:
version: 10.8.2
path: ~/.nvm/versions/node/v20.18.1/bin/npm
Watchman: Not Found
Managers:
CocoaPods:
version: 1.16.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.2
- iOS 18.2
- macOS 15.2
- tvOS 18.2
- visionOS 2.2
- watchOS 11.2
Android SDK:
API Levels:
- "33"
- "34"
Build Tools:
- 34.0.0
- 35.0.0
System Images:
- android-35 | Google APIs ARM 64 v8a
- android-35 | Google Play ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2024.2 AI-242.23339.11.2421.12700392
Xcode:
version: 16.2/16C5032a
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.13
path: /opt/homebrew/opt/openjdk@17/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: false
info React Native v0.76.6 is now available (your project is running on v0.74.2).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.76.6
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.74.2
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".
require_relative'../node_modules/@react-native-community/cli-platform-ios/native_modules'# Resolve react_native_pods.rb with node to allow for hoistingrequirePod::Executable.execute_command('node',['-p','require.resolve( "react-native/scripts/react_native_pods.rb", {paths: [process.argv[1]]}, )',__dir__]).stripplatform:ios,'16.0'prepare_react_native_project!linkage=ENV['USE_FRAMEWORKS']iflinkage != nilPod::UI.puts"Configuring Pod with #{linkage}ally linked Frameworks".greenuse_frameworks!:linkage=>linkage.to_symendtarget'moonshot'doconfig=use_native_modules!pod'Firebase',:modular_headers=>truepod'FirebaseCore',:modular_headers=>truepod'GoogleUtilities',:modular_headers=>truepod'FirebaseAppCheck',:modular_headers=>truepod'RNFS',:path=>'../node_modules/react-native-fs'use_frameworks!:linkage=>:static
$RNFirebaseAsStaticFramework =trueuse_react_native!(:path=>config[:reactNativePath],# An absolute path to your application root.:app_path=>"#{Pod::Config.instance.installation_root}/..")target'moonshotTests'doinherit!:complete# Pods for testingendpost_installdo |installer|
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202react_native_post_install(installer,config[:reactNativePath],:mac_catalyst_enabled=>false,# :ccache_enabled => true)endend
apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply from: file("../../node_modules/react-native-vector-icons/fonts.gradle")
/** * This is the configuration block to customize your React Native Android app. * By default you don't need to apply any configuration, just uncomment the lines you need.*/
react {
/* Folders */// The root of your project, i.e. where "package.json" lives. Default is '..'// root = file("../")// The folder where the react-native NPM package is. Default is ../node_modules/react-native// reactNativeDir = file("../node_modules/react-native")// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen// codegenDir = file("../node_modules/@react-native/codegen")// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js// cliFile = file("../node_modules/react-native/cli.js")/* Variants */// The list of variants to that are debuggable. For those we're going to// skip the bundling of the JS bundle and the assets. By default is just 'debug'.// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.// debuggableVariants = ["liteDebug", "prodDebug"]/* Bundling */// A list containing the node command and its flags. Default is just 'node'.// nodeExecutableAndArgs = ["node"]//// The command to run when bundling. By default is 'bundle'// bundleCommand = "ram-bundle"//// The path to the CLI configuration file. Default is empty.// bundleConfig = file(../rn-cli.config.js)//// The name of the generated asset file containing your JS bundle// bundleAssetName = "MyApplication.android.bundle"//// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'// entryFile = file("../js/MyApplication.android.js")//// A list of extra flags to pass to the 'bundle' commands.// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle// extraPackagerArgs = []/* Hermes Commands */// The hermes compiler command to run. By default it is 'hermesc'// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"//// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"// hermesFlags = ["-O", "-output-source-map"]
}
/** * The preferred build flavor of JavaScriptCore (JSC) * * For example, to use the international variant, you can use: * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` * * The international variant includes ICU i18n library and necessary data * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that * give correct results when using with locales other than en-US. Note that * this variant is about 6MiB larger per architecture than default.*/def jscFlavor ='org.webkit:android-jsc:+'
android {
ndkVersion rootProject.ext.ndkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdk rootProject.ext.compileSdkVersion
namespace "com.moonshot"
defaultConfig {
applicationId "com.moonshot"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 11
versionName "0.1.0"
multiDexEnabled true
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
release {
storeFile file(peopleMoonshotStoreFile)
storePassword peopleMoonshotStorePassword
keyAlias peopleMoonshotKeyAlias
keyPassword peopleMoonshotKeyPwd
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.release
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
firebaseCrashlytics {
nativeSymbolUploadEnabled true
unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/out/lib'
}
}
}
}
dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
implementation ('com.facebook.fresco:animated-gif:3.1.3')
implementation(platform("com.google.firebase:firebase-bom:33.3.0"))
implementation("com.google.firebase:firebase-analytics")
implementation("com.google.firebase:firebase-appcheck-playintegrity")
implementation("com.google.firebase:firebase-appcheck-debug")
implementation("com.google.firebase:firebase-appcheck")
implementation 'com.facebook.fresco:animated-gif:3.2.0'
implementation project(':react-native-share')
if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
} else {
implementation jscFlavor
}
}
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
android/settings.gradle
rootProject.name ='moonshot'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')
include ':react-native-share'
project(':react-native-share').projectDir =newFile(rootProject.projectDir, '../node_modules/react-native-share/android')
I believe I've seen this myself, however I haven't been able to pin it down either
I fear there may be some subtle native issue here which means this:
"react-native": "0.74.2",
...is somewhat problematic. I wouldn't want to go anywhere near troubleshooting this personally without knowing I was on the most up to date code everywhere. Otherwise I risk wasting time on an already fixed EventEmitter bug or similar, and that code does change semi-frequently, especially with all the new architecture work going on
Does this reproduce for you in the example app in this repo, with the most current react-native ?
Thanks @mikehardy for the quick response. I have one more question I need assistance with, What if I want to open a GAMBannerAd redirect URL(to which ad click will redirect to), to happen within the app(maybe in a web-view), Does GAMBanner Ad returns the redirect url to us in any callback?
What happened?
Description - The onAdLoaded callback in react-native-google-mobile-ads does not behave consistently on Android. While it triggers with a slight delay on iOS (1-2 seconds or milliseconds), it never gets triggered in certain instances on Android. This inconsistency makes it difficult to manage states like loading indicators reliably.
P.S: We are using Banner Ads and FLUID.
Platform
• Android: onAdLoaded is unreliable and sometimes does not trigger.
• iOS: onAdLoaded works, albeit with a slight delay.
Steps to Reproduce
1. Implement a GAMBannerAd component with the onAdLoaded callback.
2. Use the following configuration for the ad:
- Ad unit ID: /3865/ddm.people.app(any id can be used)
- Sizes: ['FLUID', '300x250', '300x600']
Example :
<GAMBannerAd requestOptions={{ networkExtras: {}, customTargeting: { type: 'app', slot: props.id, sceneIndex:
${props.activeIndex}, frameWidth:
${adWidth}, frameHeight:
${adHeight}, }, }} unitId={adUnitId} sizes={sizes} onAdFailedToLoad={() => console.log('Ad failed to load')} onAdLoaded={handleAdLoaded} />
3. Test the ad on both Android and iOS devices.
Platforms
Only on Android
React Native Info
Are your using Typescript?
package.json
app.json
ios/Podfile
android/build.gradle
android/app/build.gradle
android/settings.gradle
AndroidManifest.xml
The text was updated successfully, but these errors were encountered: