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

Firebase.json with product flavours. #3507

Closed
Acetyld opened this issue Apr 21, 2020 · 10 comments
Closed

Firebase.json with product flavours. #3507

Acetyld opened this issue Apr 21, 2020 · 10 comments
Labels
plugin: admob Google AdMob Type: Stale Issue has become stale - automatically added by Stale bot

Comments

@Acetyld
Copy link

Acetyld commented Apr 21, 2020

Hello,

We are using product flavors for whitelabeling.
How do we use mulitple firebase.json for admob?
Because we can only specify:
"admob_android_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx", "admob_ios_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx"
And we have atm 3 different flavours with each their own android/ios firebase.

We would love to hear! Maybe its possible to set it when intializing admob?

@Ehesp
Copy link
Member

Ehesp commented Apr 21, 2020

Hmm, not possible right now. Quickest solution would be to make a quick script which is run before build. The script could read and parse the file, change the JSON values to whatever you need for that build and write the file again.

@Acetyld
Copy link
Author

Acetyld commented Apr 21, 2020

Hey! Is is possible to place the id's inside the AndroidManifest.xml, like this: https://developers.google.com/admob/android/quick-start
<manifest> <application> <!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 --> <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/> </application> </manifest>

Would love to hear!

@Acetyld
Copy link
Author

Acetyld commented Apr 21, 2020

Hmm, not possible right now. Quickest solution would be to make a quick script which is run before build. The script could read and parse the file, change the JSON values to whatever you need for that build and write the file again.

ATM we got it inside the androidmanifest and the info.plist on GADApplicationIdentifier, (https://developers.google.com/admob/ios/quick-start) and we are getting ads.

So this could work right? Atleast it does for us! =)

Screenshot_10
We do this so react native firebase if not replacing it.

@mikehardy
Copy link
Collaborator

For java something like this for your flavors should work? #3504 (comment)

@stale
Copy link

stale bot commented May 20, 2020

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 the community's attention?

This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.

@stale stale bot added the Type: Stale Issue has become stale - automatically added by Stale bot label May 20, 2020
@stale
Copy link

stale bot commented Jun 5, 2020

Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Jun 5, 2020
@medonagy45
Copy link

Is there any solution as I am facing the same problem ??

@Acetyld
Copy link
Author

Acetyld commented Jul 13, 2021

Is there any solution as I am facing the same problem ??

Yes see my reaction earlier, this is what we use right now. It overrides the firebase.json
And for iOS same thing see:
https://developers.google.com/admob/ios/quick-start

@medonagy45
Copy link

It worked for me to show the ads right , but I think the ads for the two flavors got recorded on Admob for the one mentioned in firebase.json

@mikehardy
Copy link
Collaborator

It should be noted that the firebase.json is more of a convenience than anything (similar to the google-services.json file). There is no requirement that you use it and for more complex projects (like, with flavors etc), there should be nothing stopping you from removing the related values from firebase.json and directly entering the related values in AndroidManifest.xml or Info.plist.

If you chase the config / init code in @react-native-firebase/app through you'll see that it is just taking those values from firebase.json and interpolating them in to the manifest/plist for you. So should work fine to cut that out for the values you need to override and do it yourself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: admob Google AdMob Type: Stale Issue has become stale - automatically added by Stale bot
Projects
None yet
Development

No branches or pull requests

5 participants