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
710 stars 148 forks source link

[🐛] Unable to load test ads #295

Closed panktiszluck closed 1 year ago

panktiszluck commented 1 year ago

What happened?

Hi, I am getting below error for testIds, happening with interstitial video, interstitial reward, and rewarded video ads. [Error: [googleMobileAds/no-fill] Request Error: No ad to show.]

I have configured and initialize as below

try {
      mobileAds()
        .setRequestConfiguration({
          // Update all future requests suitable for parental guidance
          maxAdContentRating: MaxAdContentRating.PG,

          // Indicates that you want your content treated as child-directed for purposes of COPPA.
          tagForChildDirectedTreatment: true,

          // Indicates that you want the ad request to be handled in a
          // manner suitable for users under the age of consent.
          tagForUnderAgeOfConsent: true,

          // An array of test device IDs to allow.
          testDeviceIdentifiers: [
            'EMULATOR',
            'E62FB4E1-FEAF-XXXX-XXXX-XXXXXXXXXXXX'
          ]
        })
        .then(() => {
          // Request config successfully set!
          //Initialize react-native-google-mobile-ads
          mobileAds()
            .initialize()
            // eslint-disable-next-line @typescript-eslint/no-unused-vars
            .then((adapterStatuses: any) => {
              // Initialization complete!
              // console.log('adapterStatuses', adapterStatuses);
              setIsAdInit(true);
            });
        });
    } catch (e: any) {
      // eslint-disable-next-line no-restricted-syntax
      console.log(e);
    }

Using ad hooks for implementations like,

  //Interstitial Ad object
  const interstitialAd = useInterstitialAd(adInterUnitId, {
    requestNonPersonalizedAdsOnly: true
  });

Expected: Show ad when call interstitialAd.show();

Actual: [Error: [googleMobileAds/no-fill] Request Error: No ad to show.]

Platforms

Android and iOS

React Native Info

"react-native-google-mobile-ads": "^8.2.2",
"react-native": "0.64.1",

### Are your using Typescript?

- [X] My project is using Typescript

### package.json

```JSON
{
  "name": "MyApp",
  "version": "0.0.1",
  "private": true,
  "author": "",
  "license": "MIT",
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
    "fixcode": "eslint --fix --ext .js,.jsx,.ts,.tsx ./src",
    "android-clean": "cd android && ./gradlew clean",
    "apk": "cd android && ./gradlew assembleRelease",
    "bundle": "cd android && ./gradlew bundleRelease",
    "clean": "rm -rf node_modules ios/Pods && yarn && npx pod-install ios",
    "postinstall": "patch-package"
  },
  "dependencies": {
    "@bugsnag/react-native": "^7.13.2",
    "@bugsnag/react-native-cli": "^7.10.5",
    "@react-native-async-storage/async-storage": "^1.15.5",
    "@react-native-clipboard/clipboard": "^1.8.4",
    "@react-native-community/blur": "^3.6.0",
    "@react-native-community/cameraroll": "^4.0.4",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-community/push-notification-ios": "^1.10.1",
    "@react-native-community/slider": "^3.0.3",
    "@react-native-firebase/analytics": "^14.2.3",
    "@react-native-firebase/app": "^14.2.3",
    "@react-native-firebase/messaging": "^14.2.3",
    "@react-navigation/bottom-tabs": "^5.11.11",
    "@react-navigation/material-top-tabs": "^5.3.15",
    "@react-navigation/native": "^5.9.4",
    "@react-navigation/stack": "^5.14.5",
    "axios": "^0.24.0",
    "dayjs": "^1.10.6",
    "global": "^4.4.0",
    "lodash": "^4.17.21",
    "lottie-ios": "3.4.0",
    "lottie-react-native": "^5.1.4",
    "moment": "^2.29.1",
    "moment-timezone": "^0.5.39",
    "patch-package": "^6.4.7",
    "postinstall-postinstall": "^2.1.0",
    "react": "17.0.1",
    "react-content-loader": "^6.0.3",
    "react-copy-to-clipboard": "^5.0.3",
    "react-native": "0.64.1",
    "react-native-actions-sheet": "^0.4.9",
    "react-native-animatable": "^1.3.3",
    "react-native-animated-input": "^1.1.0",
    "react-native-change-icon": "^4.0.0",
    "react-native-detector": "^0.2.3",
    "react-native-draggable-flatlist": "^3.0.5",
    "react-native-draggable-grid": "^2.1.4",
    "react-native-draggable-gridview": "^1.0.3",
    "react-native-extended-stylesheet": "^0.12.0",
    "react-native-fast-image": "^8.5.11",
    "react-native-fs": "^2.19.0",
    "react-native-gesture-handler": "^1.10.3",
    "react-native-google-mobile-ads": "^8.2.2",
    "react-native-haptic-feedback": "^1.13.0",
    "react-native-htmlview": "^0.16.0",
    "react-native-iap": "^7.5.4",
    "react-native-image-crop-picker": "^0.37.3",
    "react-native-image-picker": "^4.0.5",
    "react-native-image-viewing": "^0.2.2",
    "react-native-inappbrowser-reborn": "^3.6.3",
    "react-native-keyboard-aware-scroll-view": "^0.9.4",
    "react-native-keyboard-manager": "^6.5.4-4",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-pager-view": "^5.2.1",
    "react-native-permissions": "^3.3.1",
    "react-native-push-notification": "^8.1.1",
    "react-native-rate": "^1.2.9",
    "react-native-raw-bottom-sheet": "^2.2.0",
    "react-native-reanimated": "^2.2.3",
    "react-native-safe-area-context": "^3.2.0",
    "react-native-screens": "^3.4.0",
    "react-native-share": "6.4.0",
    "react-native-slider": "^0.11.0",
    "react-native-smooth-picker": "^1.1.5",
    "react-native-sms": "^1.11.0",
    "react-native-snap-carousel": "^4.0.0-beta.6",
    "react-native-splash-screen": "git+https://github.com/zlucksolutions/react-native-splash-screen.git",
    "react-native-svg": "^12.1.1",
    "react-native-swipeable-item": "2.0.1",
    "react-native-tab-view": "^3.0.1",
    "react-native-textinput-effects": "^0.6.2",
    "react-native-toast-message": "^2.1.5",
    "react-native-tts": "^4.1.0",
    "react-native-view-shot": "^3.1.2",
    "react-native-walkthrough-tooltip": "^1.3.0",
    "react-native-webview": "^11.26.0",
    "react-native-wheely": "^0.3.2",
    "react-native-youtube-iframe": "^2.1.2",
    "react-redux": "^7.2.4",
    "redux": "^4.1.1",
    "redux-logger": "^3.0.6",
    "redux-persist": "^6.0.0",
    "redux-saga": "^1.1.3",
    "redux-thunk": "^2.3.0",
    "rn-fetch-blob": "^0.12.0",
    "toggle-switch-react-native": "^3.2.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "@types/jest": "^26.0.23",
    "@types/lodash": "^4.14.177",
    "@types/react": "^17",
    "@types/react-native": "^0.64.5",
    "@types/react-native-push-notification": "^7.3.2",
    "@types/react-native-snap-carousel": "^3.8.4",
    "@types/react-redux": "^7.1.16",
    "@types/react-test-renderer": "^16.9.2",
    "@types/redux-logger": "^3.0.8",
    "babel-jest": "^26.6.3",
    "eslint": "^7.14.0",
    "jest": "^26.6.3",
    "jsc-android": "^250230.2.1",
    "metro-react-native-babel-preset": "^0.64.0",
    "react-test-renderer": "17.0.1",
    "typescript": "^3.8.3"
  },
  "jest": {
    "preset": "react-native",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "jsx",
      "json",
      "node"
    ]
  }
}

app.json

{
  "name": "MyApp",
  "displayName": "MyApp",
  "react-native-google-mobile-ads": {
    "android_app_id": "ca-app-pub-3940256099942544~3347511713",
    "ios_app_id": "ca-app-pub-3940256099942544~1458002511"
  },
}

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 1 year 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.