invertase / react-native-google-mobile-ads

React Native Google Mobile Ads enables you to monetize your app with AdMob.
https://docs.page/invertase/react-native-google-mobile-ads
Other
673 stars 135 forks source link

[🐛] Bug Report Title - Ads stop showing after about a day or so. #533

Closed szech696 closed 6 months ago

szech696 commented 8 months ago

What happened?

Hello,

My interstitial ads stop showing if the app hasn't been closed for about a day. To clarify the app will be running in the background and foreground for about a day, and unless I completely close out of the app and reopen it then the ads will stop showing completely. I've tried calling: mobileAds().initialize().then(adapterStatuses => {}).catch(err => setIsLoaded(false)); once every 4 hours, this did not work.

I am now trying to force a reload of the component whenever the app transitions from the background to foreground. I'm unsure if this will work though.

The ads are being triggered from a redux state change, in order to limit ads being shown every X minutes. I've tested this function, and the state is updating just fine, and once again works for about a day and then completely stops showing ads. Once I close and reopen the app, the ads begin showing again.

I'm completely lost on why this is happening, and have come to the conclusion that this is a bug with the library.

Has anyone else had this issue, and a potential fix?

Platforms

Android, but have not tested behavior on iOS

React Native Info

System:
  OS: macOS 14.1.2
  CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Memory: 25.11 MB / 16.00 GB
  Shell:
    version: 3.2.57
    path: /bin/bash
Binaries:
  Node:
    version: 20.5.0
    path: /usr/local/bin/node
  Yarn:
    version: 1.17.3
    path: /usr/local/bin/yarn
  npm:
    version: 9.8.0
    path: /usr/local/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.9.3
    path: /usr/local/bin/pod
SDKs:
  iOS SDK: Not Found
  Android SDK:
    API Levels:
      - "33"
      - "34"
    Build Tools:
      - 30.0.3
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-34 | Google APIs Intel x86_64 Atom
    Android NDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11076708
  Xcode:
    version: 11.1/11A1027
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.1
    wanted: 0.73.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Are your using Typescript?

package.json

{
  "name": "app_name",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest --silent false"
  },
  "dependencies": {
    "@notifee/react-native": "^7.8.0",
    "@react-native-async-storage/async-storage": "^1.21.0",
    "@react-navigation/bottom-tabs": "^6.5.11",
    "@react-navigation/native": "^6.1.9",
    "@react-navigation/stack": "^6.3.20",
    "@rneui/base": "^4.0.0-rc.7",
    "@rneui/themed": "^4.0.0-rc.8",
    "react": "18.2.0",
    "react-native": "0.73.1",
    "react-native-calendars": "^1.1303.0",
    "react-native-date-picker": "^4.3.4",
    "react-native-dimension": "^1.0.6",
    "react-native-dropdown-picker": "^5.4.6",
    "react-native-fast-image": "^8.6.3",
    "react-native-gesture-handler": "^2.14.0",
    "react-native-google-mobile-ads": "^12.6.0",
    "react-native-reanimated": "^3.6.1",
    "react-native-responsive-screen": "^1.4.2",
    "react-native-safe-area-context": "^3.3.2",
    "react-native-screens": "^3.27.0",
    "react-native-shared-group-preferences": "^1.1.24",
    "react-native-svg": "^12.1.1",
    "react-native-vector-icons": "^10.0.3",
    "react-redux": "^9.0.2",
    "redux": "^5.0.0",
    "redux-persist": "^6.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@jest/globals": "^29.7.0",
    "@react-native/babel-preset": "^0.73.18",
    "@react-native/eslint-config": "^0.73.1",
    "@react-native/metro-config": "^0.73.2",
    "@react-native/typescript-config": "^0.73.1",
    "@testing-library/react-native": "^12.4.3",
    "@types/react": "^18.2.6",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.6.3",
    "eslint": "^8.19.0",
    "jest": "^29.6.3",
    "prettier": "2.8.8",
    "react-test-renderer": "18.2.0",
    "redux-mock-store": "^1.5.4",
    "typescript": "5.0.4"
  },
  "engines": {
    "node": ">=18"
  }
}

app.json

{
  "name": "app_name",
  "displayName": "app_name",
  "react-native-google-mobile-ads": {
    "android_app_id": "ca-app-pub-xxxxxxxxxxxxxxxx~xxxxxxxxxx"
  }
}

ios/Podfile

No response

android/build.gradle

No response

android/app/build.gradle

No response

android/settings.gradle

No response

AndroidManifest.xml

No response

github-actions[bot] commented 7 months ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.