react-native-google-mobile-ads icon indicating copy to clipboard operation
react-native-google-mobile-ads copied to clipboard

Android Rich Media Ads not Focusable

Open IcarusComplex opened this issue 1 year ago • 3 comments

Hello!

We run many rich media ads for our partners on our platforms. Since migrating over to this project rich media ads with <input> tags in the creatives have not been focusable, i.e. the keyboard never appears and we cannot capture user information. A longpress does show the paste options for the field.

Using version 8.1.0 as reference. This is due to line 165 in ReactNativeGoogleMobileAdsBannerAdViewManager.java, adView.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);. Any reason why the focusability of descendants is being disabled?

In the meantime we've created a fork and commented out this line so the <input> fields in our creatives are working as intended. Any other way we can achieve the same behaviour?

Thank you!

IcarusComplex avatar Sep 19 '22 11:09 IcarusComplex

Hey, just some context:

adView.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS); was added in 835bdec6aff843e2ef21250137927fb004750aeb to prevent a crash described here.

DoctorJohn avatar Sep 19 '22 13:09 DoctorJohn

Interesting! Great investigation @DoctorJohn I've posted in the forum asking for an update since it appears to be a native SDK issue https://groups.google.com/g/google-admob-ads-sdk/c/EsLEaoRjyNM/m/3mCjddGcAAAJ

It's also possible they have resolved it, who knows?

@IcarusComplex this appears to be a very long-running issue, which leaves me open to a workaround if it's important to you and done cleanly

Specifically if you proposed a PR that allowed for setting a potentially dangerous parameter (that is, named like "allowInputInAdsWithCrashRisk" or something) so you could boolean toggle it on and conditionally not set that block descendants config on the view, it could work. And you/we may discover that it no longer crashes and the bug was inadvertently fixed in some SDK update.

Or if you're fine with patch-package you can just roll with that.

mikehardy avatar Sep 19 '22 13:09 mikehardy

@DoctorJohn Thank you for the context, exactly what I was looking for.

@mikehardy Thank you. Given how important this is to our commercial teams I'm going to create a fork doing something similar to what you've described so I'll be able to turn this on/off in prod via remote config incase this does introduce a crash.

Whether it's stable or introduces a crash I'll provide some feedback here. If its stable, I'll look into creating a PR that implements a clean workaround.

IcarusComplex avatar Sep 19 '22 16:09 IcarusComplex

@mikehardy - just an update, finally had this in a release about a week ago. Since then we're having some native crashes on screens with Ads, not much to go on in the crashlytics logs unfortunately. Will share a more detailed update when I find a gap, for now just an update that I'm still monitoring this.

IcarusComplex avatar Oct 18 '22 07:10 IcarusComplex