I recently deployed an app to the play store and i am using firebase as backend. However, now I want to add some features to the app and want to create different environments so that i can test the app in a similar environment before releasing to production.
I went through these links online but I have some doubts.
https://medium.com/#Miqubel/multiple-build-types-in-firebase-on-android-6f6715f6dd83
https://web.archive.org/web/20160310115701/https://www.firebase.com/blog/2015-10-29-managing-development-environments.html
The app currently in PROD has database, functions and storage configured. So my goal is to have a mirror image of this setup through which i would test my app without affecting anything in the PROD database setup.
So far what i have figured out is:
1: I need to have different build types in my build gradle.
2: Somehow make my different build for DEV and PROD point to different databases on firebase.
Confusion:
Should I create two different projects on firebase or have two apps in 1 project?
When we have two apps in one firebase project does it have separate database or a single shared database?
It's recommended to have different projects for each environment that you want to test separately. Don't use the same project for development and production, because your changes during development could cause problems in production.
Please read this blog for more information.
Related
I'm working on an Android app that uses Firebase for a few different functions. I'm currently trying to expand from a single Firebase project to 3 to represent development, staging, and production environments.
All of my projects need to use the same bundle ID because of a restriction by another tool I'm using (RevenueCat). What I'm noticing with this setup is that, even when using different google-services.json files, I'm always pointing to my original, production Firebase project.
I've searched around and seen some things about needing to add SHA-1 values on Android to differentiate the apps. I've tried adding the SHA-1 from the app signing key certificate in the Google Play Console to the production project and the SHA-1 from the ./gradlew signingReport output to the staging project. Still no dice, unfortunately.
Does anyone have experience with this kind of setup or any other ideas to try? Thanks so much!
In this case, it turns out I just needed to clear out the app/build folder. Apparently the Firebase configs get "cached" in some way between builds, so clearing it forces it to use the new configuration.
I've just added it as a step in the build process. After this small change, everything is working as expected.
Having several different apps inside one project with the same bundleId/packageName is impossible. You have the possibility to use one google-services.json for several apps, though - you just need to add several apps to your project. The packageName/bundleId of those apps should be different, though.
It is very usual for your case - splitting the app into several flavors to have an appId suffix. For example com.example.app.prod, com.example.app.stage, com.example.app.dev - the suffix can be configure in the gradle.build for each flavor. The issue is that you will have to have different apps inside the firebase project or different projects for each flavor - depending on your needs. For example, when the apps are part of the same project, they will share auth and database storage but will have separate crashlitycs, etc. The different projects will have everything different.
SHA-1 is a bit different thing - it is meant to limit/enable/disable the usage of the APIs based on the signing certificate. There may be several SHA-1 for the same package name. Moreover, SHA-1 only works for Android apps.
What you can do is to create several projects - one for each flavor and register the app under the same package name inside each one - you are able to do that! Each flavor will have to have its own google-services.json file in the appropriate folder.
It works really well with the different package names.
I have never tried this approach with the same packageName, and I don't know the possible drawbacks, so I assume you may face some issues. Or not.
In most of the cases, a simple configuration using google-services.json will be enough for having different Firebase environments in your App. But as we saw, things can get complex very quickly, and depending on the requirements custom ways for configuration and initialization of the Firebase services can be needed. I this article I tried to summarize the different approaches for achieving this goal and share my personal experience. I hope that it was helpful to you and that you enjoyed it.
I'm an android developper and i've a few apps published on google play... I do myself every single aspect of my apps including maintence.
I've two similar apps that share some core API... they dont share database nor storage, just some java API of my own and some google cloud functions i made (public)
When i was preparing the firebase infrastructue to run the second one i decided for creating a second app in the same firebase project as the first one... this was a decision made basically because i hated the firebase "switch between projects" tools.
my question is:
what are the advantages and disadvntages of having multiple apps sharing same firebase project?
when should i create a new project for a new app and when should i reuse the project
I'm a single self suficient developper so any sort of "project permissions" wont make difference to me
The primary reason to have multiple apps in the same project is when you want to share database and user data between them. Multiple apps in the same project are definitely expected to share data and configuration across all Firebase products. A common use case is when you have an end-user app and an admin app, both working against the same data.
If you're not sharing data between the apps, then you will only run into future trouble if you have multiple apps in the same project. (For example, see this question which was asked at the same time as yours.)
I've created 2 different firebase projects. One for development and one for production (myProjectDev, and myProject). I've also created an app with Ionic that runs on both ios and android platforms.
I want to use the same bundle/package ID for both firebase projects because if I change the bundle/package ID then I'm forced to setup an entirely separate app in TestFlight/Google play store. I feel like I shouldn't have to do that but then again I'm new to a lot of this.
So with that being said I'm trying to figure out how to generate 2 different SHA-1 keys for the same package ID (com.mycompany.myproject)
I suppose that you can't do that.Instead you can choose paid database instead of Spark so that you can use two separate databases for the same project with same package.
Let's say I put an app on the app store and now, I want to rework the app and change/add some functionalities. Since my local Project Folder can only be connected to one Firebase database and that database is now live, do I have to create a completely new project which is a clone of the original and work on that? Or is there a better way?
Short answer is, yes.
Long answer is....
You need different environments for your application. Production vs Lower environments.
Production is customer facing.
Lower is not customer facing.
Here is the thing, as you make changes to your application (pointing to lower environment), this app will then replace the current production application. When you release your application, you release your server updates as well. If you add nodes to your firebase, then they will be created respectfully. If you need to update / change names, you need to make sure you do this while the application gets updated.
But, yes, two separate databases. Its easy to update the app, just create a new project and point the app to the new API keys... done.
You should have different Firebase projects for different environments, such as development, staging, and production. It's usually not a good idea to develop against a project that your users are actively using, as you might make a mistake and disrupt their experience.
I am looking for firebase to log data with my debug build and my release build separately. So when I am testing my app, I am not flooding my Analytics with non-user info. Can anyone point me in the right direct or know of a tutorial on this?
Bob's comment points in the correct direction. It's recommended for developers to set up multiple Firebase projects to achieve isolation of data between the same app running in different environments. This also gives you a safe place to experiment and develop without affecting your production users.