Flutter Firebase/Admob with multiple environments - firebase

I have two firebase project, one for dev and one for my live environment.
The same goes for the android configuration, one "dev" and one "live" environment.
Now im trying to use the flutter Firebase Admob package.
Each environment has a different app id like com.myapp.dev and com.myapp.live
I think on the app mob site only com.myapp.live is available. Do I need as well here two configs or can't I just show test ads without it?
Or how the connection works?
If I copy the Admob app id (probably related to com.myapp.live?) and use it in the android manifest under the main and/or the "dev" env folder I get always an error that Admob is not configured correctly.
Every other firebase service works fine with the google.services split-up in the different env folders.
EDIT:
I created a new Admob entry for com.myapp.dev, linked it with firebase and it still not work when im using the new Admob app id.

Related

Notifications not received in react native after switching firebase projects

I'm creating an app using react native and firebase messaging. Some time ago I created development firebase project and now I have to switch it to another project, but there is a problem. I created new project and changed google-services.json file in /android/app and it seems to take correct values from this file, because they are in /android/app/build/generated/res/google-services/debug/values/values.xml, but even though the values seems correct, the messaging works only with previous project, notifications from new project are not received. The configuration for both firebase projects seems almost identical and I have no clue how to fix that. I already tried deleting build directory from /android/app and running app with npm run android --reset-cache but it did nothing. Any ideas on what is the cause for that?

Creating an app variant in a firebase unity project

I have en existing app (e.g com.company.app1)made in Unity, that occasionally pulls content from firebase in the live environment (after being built).
Now I am trying to make a second build, with a different project id (com.company.app2). This second build does not use firebase after being built - it loads data from firebase before being built, and therefore already contains the needed data.
I have added com.company.app2 as a second android app in my firebase configuration, but when trying to install the resulting app2.apk there's a clash between it and the existing installed app1.apk.
Below is the error Unity is showing when I press it's "Build and Run" button.
stderr[
adb: failed to install C:\Users\*\*\*\*\app2.apk: Failure [INSTALL_FAILED_CONFLICTING_PROVIDER: Scanning Failed.:
Can't install because provider name
com.company.app1.firebaseinitprovider (in package com.company.app2) is already used by com.company.app1]
]
My question is, how can I change the provider name in app2 so both app1 and app2 can coexist on the same device?
(I need to interface with firebase shortly before building, so I can't just remove the SDK).
Alright, so I ended up just removing the SDK, that works.
Sorry to anyone who has some similar problem.

FLUTTER FIREBASE Change to new instance not working for Android

My client has recently changed their Firebase instance (meaning its under a different project, in a different google sign on). I.e. they have a new instance that they want to use for production. I created the new instance and project with a different name to avoid any confusion. So for Android i removed the old google-services.json and downloaded the new one from Firebase and copied it into the android/app directory. Then I reviewed the project level and app level gradel files. No problems there. I checked inside the new google-services.json file and can clearly see that it is pointing to the new instance of Firebase.
Here's a snippet below:
"project_info": {
"project_number": "506498949424",
"firebase_url": "https://lbds-aeb3d.firebaseio.com",
"project_id": "lbds-aeb3d",
"storage_bucket": "lbds-aeb3d.appspot.com"
},
The old name was LittleBigDeals instead of lbds.
Actually this process has worked fine for the IOS side of the project. The app is now pointing at the new database.
However when I install it on ANdroid it still retrieves data from the old database.
Is there a pointer I'm missing or that I need to refresh in the Android set up.
Any help with this would be greatly appreciated.
Many thanks.
I had this same issue yesterday. I had changed to a different Firebase project in my Flutter app. iOS worked fine but Android still was attempting to use the incorrect Firebase project, despite google-services.json clearly pointing to the new project. The issue appeared to be limited to my local machine but was very bizarre and annoying. Another developer suggested that I try the "flutter clean" command, and once I ran flutter clean and re-started the virtual Android device, it then used the correct Firebase instance.

Firebase Remote Config - copy to another project

I have two projects for dev and prod. I want to be able to run a script to copy dev config to prod.
Firebase Remote Config has an API for programatically updating Remote Config. But as far as I can tell, you need to init admin with a project-specific service account. It seems like I would need two admin instances, but I'm not sure that's possible?
I'm wondering if someone has done this before and has an example script. Thanks!
See docs:
https://firebase.google.com/docs/remote-config/automate-rc
There is no Firebase Admin SDK for Flutter, so you'll have to implement this on a different platform that is supported. For a list of these platforms and instructions on setting it up, see the documentation on adding Firebase to a server.
For these platforms that the Firebase Admin SDK targets, you can create multiple instances of the FirebaseApp class, and initialize each of them with different credentials and project configuration. For examples of how to do this, see the documentation on initializing multiple apps.

NativeScript + Firebase, new firebase project is not being picked up

I am working with Master Detail with Firebase Angular template, and I can successfully build the app locally.
But then when I try to reconfigure the app for my own firebase project, nothing seems to change. It continues to query the default app's firebase.
I have followed the instructions for changing firebase app to my own to the letter but I cannot figure out why it still keeps pointing to the old app.
These are the steps I take to change the firebase app:
I create an App in Firebase, using the app id from package.json.
I download google-services.json and copy it to App_Resources/Android/google-services.json
Additionally, I delete google-services.json from platforms/android/app, just in case.
I uninstall the previously installed App from the emulator. I event deleted and created a new emulator to make sure there are no remnants of the previously built app.
I search all the files in the project for any reference for https://car-rental-b26b7.firebaseio.com which is the default firebase app that comes with the template, and I don't find anything at all.
I also edited firebase.common.ts with the following upon successful initialisation:
.then((instance) => console.log("firebase.init done", instance),
Just to see which project its initialising.
7. Finally, I build: tns run android
And sure enough, the console log shows https://car-rental-b26b7.firebaseio.com as the project being initialised.
I know for definite it is copying the new project's google-services.json over to platforms/android/app, because when I deleted the file it refused to build, as expected. Placing the file back, it builds successfully.
But I have no idea why it continues to reference the original firebase project.
Has anyone come across something similar?

Resources