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
688 stars 139 forks source link

[🐛] Unreachable close button on interstitials/rewarded on iPhone 14 Pro (Dynamic Island) #240

Closed LiveXenon closed 1 year ago

LiveXenon commented 2 years ago
Schermata 2022-10-05 alle 14 26 32

package.json:

    "react-native-google-mobile-ads": "^8.1.1",
    "react-native": "0.66.3",
mikehardy commented 2 years ago

I understand the problem but I'm not sure what we can do, I think those are controlled by the underlying SDK

They don't really specify what their bugfixes etc are but they do have some: https://developers.google.com/admob/ios/rel-notes

What happens if you try the new iOS SDK version by specifying this variable referenced here in your Podfile: https://github.com/invertase/react-native-google-mobile-ads/blob/365f1a4b733a3efa7a81fd174fcc2839cbbfd23e/RNGoogleMobileAds.podspec#L36

We are still on 9.10.0 so maybe that helps? https://github.com/invertase/react-native-google-mobile-ads/blob/365f1a4b733a3efa7a81fd174fcc2839cbbfd23e/package.json#L44

Otherwise I'm unsure - if that does not help, you can try putting it in react-native-safe-area-context or if that does not work then perhaps we have a bug here?

If so then probably something in here needs a change but you would need to compare the admob reference documentation vs this implementation (usually mixed in with some stackoverflow....) to see if we are missing something or should do something different https://github.com/invertase/react-native-google-mobile-ads/blob/main/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenAd.swift

I won't have time to look into this much further but that is a lot of information right there, hopefully that can help you find a solution, and I will happily merge any PR if one is needed

LiveXenon commented 2 years ago

Thanks for the answer @mikehardy, unfortunately I think the problem is also present in the 9.11.0 version of the SDK, here's what i found:

https://groups.google.com/g/google-admob-ads-sdk/c/JqS14ZpvTGw https://groups.google.com/g/google-admob-ads-sdk/c/LirzuBcswUY

In particular in the first thread a user says that:

When you build app with xcode14.0 , this happens with iphone 14 pro. When you build with xcode13.0, APPLE will auto adjust the layout for old app to fit iphone 14 pro, so it looks fine.

mikehardy commented 2 years ago

https://groups.google.com/g/google-admob-ads-sdk/c/JqS14ZpvTGw/m/xtLOEXwJAgAJ

Thank you for raising this to us. The reported behavior has been flagged to a wider team for investigation. We'll update this thread the soonest the team share their feedback.

Can maybe subscribe here for updates: https://github.com/googleads/googleads-mobile-ios-examples/issues/292

Not sure what action to take other than to build with Xcode 13.x (apparently this works?) or to stop targeting devices with dynamic island temporarily while waiting for a fix

LiveXenon commented 1 year ago

I report what was said by the Mobile Ads SDK Team (https://groups.google.com/g/google-admob-ads-sdk/c/JqS14ZpvTGw/m/xtLOEXwJAgAJ):

Hi All,

I hope you're doing well.

I just want to circle back on this. The team mentioned that, the GMA SDK attempts to hide the status bar when full screen ads are presented, but sometimes the way a publisher is implementing their view controller's prevents us from doing so. It's difficult to explain the exact cause without seeing the publisher's app, but basically, when a view controller is presented modally, the view controller on top is supposed to be able to control the status bar's presentation state. It's also possible to present a view controller as a "child" of another view controller, though, and in that case control of the status bar stays with the parent view controller. If our ads are presented from a child's stack, we can't hide the status bar.

In addition to that, Apple provides APIs that allow parent view controllers to hand off status bar control to children. You can verify your implementation and consider implementing an API like this in your app to make sure GMA's ads can control the status bar.

Unfortunately I don't have the skills to verify this but I hope someone will be able to do it.

DoctorJohn commented 1 year ago

@LiveXenon you could try to work around this issue by hidding the status bar using react native apis when a user triggers a interstitial/rewarded ad. Maybe that could be a workaround until someone steps up and attempts to fix this issue in our native code.

(there is a chance I'll start using interstitial ads in one of my iOS apps soon-ish, in case I'll be confronted with this issue, I'll attempt to fix it. Until then I would be hard for me to verify potential fixes).

LiveXenon commented 1 year ago

@DoctorJohn thanks for the tip, in extreme cases i believe i will remove ads on iPhone 14 Pro and iPhone 14 Pro Max for now.

I attach the logs extracted from Xcode when an interstitial ad is opened:

2022-11-01 10:33:31.146878+0100 TESTAPP[2920:30704] Status bar could not be hidden for full screen ad. Ensure that your app is configured to allow full screen ads to control the status bar. For example, consider whether you need to set the childViewControllerForStatusBarHidden property on your ad's rootViewController.

LiveXenon commented 1 year ago

It seems that compiling the app with Xcode Version 14.1 (14B47b) and iOS 16.1 solves the problem, I can't give an explanation but this is the result:

Screenshot 2022-11-12 alle 18 40 33

My app uses React Native, the only modules I've updated are:

 "react-native": "0.66.3" ->  "0.66.5"
 "react-native-screens": "^3.9.0" -> "^3.14.0"

This is the current version of the react-native-google-mobile-ads module

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

I hope this can help someone.

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.

zoobibackups commented 1 year ago

I have the same issue with

Xcode (Version 14.3.1 (14E300c)) "react-native-google-mobile-ads": "^8.1.0",

pod 'Google-Mobile-Ads-SDK',"9.12.0" pod 'GoogleMobileAdsMediationFacebook','6.11.0.0'

iOS version 16.5

Robiullah2244 commented 1 year ago

You can solve this by hiding the status bar when a fullscreen ad shows and bringing it back after it was closed.

This is my code to solve this issue:

const [isStatusBarhiddden, setIsStatusBarhiddden] = useState(false);

const unsubscribeLoaded = rewardedInterstitial?.addAdEventListener(
  RewardedAdEventType.LOADED,
  () => {
    setIsStatusBarhiddden(true);
  },
);

const unsubscribeClosed = rewardedInterstitial?.addAdEventListener(
  AdEventType.CLOSED,
  () => {
    setIsStatusBarhiddden(false);
  },
);

return(
  <StatusBar hidden={isStatusBarhiddden} />
)