Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔥 Can AdMob be an optional 'dormant' part of a white-label app? #4073

Closed
2 of 10 tasks
gavrichards opened this issue Aug 11, 2020 · 7 comments
Closed
2 of 10 tasks

Comments

@gavrichards
Copy link

Issue

My React Native app is a white-label app which I build and maintain for many customers. It's deployed using Fastlane as part of an automated build and deployment process.

I have built AdMob into my app using this library and it all works great.

My problem is that I need to make AdMob an optional feature of our app for our customers. Some may want to use it in their app, others will not.

In an ideal world, the AdMob app IDs would be fed into the app via an API call at app runtime, but from what I can gather that's not possible and they must be included in firebase.json at build time. This is acceptable as we can inform our customers that they can only set or change their app IDs when we build and submit their app to the store.

I have included admob_delay_app_measurement_init: true in firebase.json as we are using the consent flow.

The issue is that if I try to run the app without admob_ios_app_id and admob_android_app_id present, the app immediately crashes when it runs. Nothing is reported in the console.

I've also tried including these parameters but populating them with empty values or "na" but the app still crashes. This suggests that the app is immediately validating these app IDs somehow (with a remote server?) which is surprising considering I have left admob_delay_app_measurement_init: true in firebase.json, which I would've expected meant that no AdMob API calls were made until the firebase.admob().initialize() method is called.

Lastly I have tried removing all three parameters from firebase.json, but the app still crashes immediately.

So is there a way to integrate React Native Firebase AdMob into an app's codebase but have it inactive/dormant? Or am I going to need to have a separate branch of my codebase without AdMob in it entirely for those customers who don't wish to use it?


Project Files

Javascript

Click To Expand

package.json:

# N/A

firebase.json for react-native-firebase v6:

{
  "react-native": {
    "analytics_auto_collection_enabled": false,
    "admob_android_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx",
    "admob_ios_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx",
    "admob_delay_app_measurement_init": true
  }
}

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
# N/A

AppDelegate.m:

// N/A


Android

Click To Expand

Have you converted to AndroidX?

  • my application is an AndroidX application?
  • I am using android/gradle.settings jetifier=true for Android compatibility?
  • I am using the NPM package jetifier for react-native compatibility?

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

Click To Expand

react-native info output:

info Fetching system and libraries information...
System:
    OS: macOS 10.15.6
    CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
    Memory: 2.36 GB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.16.3 - /usr/local/opt/node@12/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/opt/node@12/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.6, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 25, 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.0.1 4.0.1
    Xcode: 11.6/11E708 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_232 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.2 => 0.63.2 
  npmGlobalPackages:
    *react-native*: Not Found

  • Platform that you're experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • react-native-firebase version you're using that has this issue:
    • 8.3.0
  • Firebase module(s) you're using that has the issue:
    • AdMob
  • Are you using TypeScript?
    • N


@mikehardy
Copy link
Collaborator

mikehardy commented Aug 11, 2020

Have you tried simply using the Google sample AdMob ids? https://github.com/mikehardy/rnfbdemo/blob/eda24a71990e95e8a91b17b27b0cc1417031808b/make-demo.sh#L122

That said, you may run in to other problems with your clients if they intend to publish iOS apps marketed for children: #4021 meaning you may need to have two separate builds completely, one of which follows whatever the resolution of #4021 is (likely be not including the @react-native-firebase/analytics and admob at all, plus using a newer version once the podspec is ironed out), and one that has all that stuff

@Salakar
Copy link
Member

Salakar commented Aug 12, 2020

There's no way as far as I know to have no ids, the underlying AdMob sdks expect these and will crash your app on start if not found unfortunately.

You could deploy using the sample ids as Mike suggested above, but should also note the suggestion if your iOS app is marketed for children.

@gavrichards
Copy link
Author

Thanks both. I wasn't sure if there were any side effects to having the sample AdMob IDs in the config file for customers who aren't using the AdMob functionality in their app. Do the sample IDs cause any reporting to happen?

The children point is an interesting one. Most of our apps don't have this issue, but one definitely does and others could in future, this we'll definitely have to consider this.

Is there any possible way you can think of that we could include the AdMob and Analytics libraries conditionally at build time, to avoid us having to maintain parallel branches of our codebase?

@mikehardy
Copy link
Collaborator

Thanks both. I wasn't sure if there were any side effects to having the sample AdMob IDs in the config file for customers who aren't using the AdMob functionality in their app. Do the sample IDs cause any reporting to happen?

Perhaps. I don't use AdMob (except to demonstrate it works and how to integrate it, as in that script) so I'm not sure.

The children point is an interesting one. Most of our apps don't have this issue, but one definitely does and others could in future, this we'll definitely have to consider this.

Is there any possible way you can think of that we could include the AdMob and Analytics libraries conditionally at build time, to avoid us having to maintain parallel branches of our codebase?

I'm not aware of any way no but my best advice is to subscribe to those upstream issues, it's an area of current work

@gavrichards
Copy link
Author

Thanks @mikehardy - do you mean #4021? It looks like that one is closed, is there further work occurring?

@mikehardy
Copy link
Collaborator

@gavrichards on your side you'll have to build an app without AdMob at all I believe, and you'll have to remove Analytics as well. Should work if you are on firebase-ios-sdk pod 6.27.1 or greater (which is the default now, on current stable react-native-firebase versions), pending confirmation from @pabloearg here #4072 (comment)

@mikehardy
Copy link
Collaborator

I'm going to close this one out - I think we've provided what info we can. This is as mentioned an area of a lot of interest on the behalf of Apple app reviewers though. You can't have analytics at all if an app targets kids (but it should be possible to pass review now regardless of module as long as it's not analytics and admob: #4134) and you can't have admob without consent, and for that you'll need up to date admob + a react-native-permissions PR applied, per #4107 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants