Link my Firebase project to BigQuery via REST API - firebase

I'm trying to create and configure Firebase project (mobile apps) automatically.
I can create the project itself and android application via terraform.
I also managed to create iOS app and link Google Analytics account (created manually via analytics console) to project using Firebase Management REST API
What I couldn't manage:
If I need to link firebase project to BigQuery: I can create bigquery dataset (and other necessary resources) with terraform but I couldn't find the way to link it to the firebase project and enable all the integration options via REST API or terraform provider (like it can be done manually via firebase GUI console: Project settings -> Integrations -> BigQuery -> Link: Google Analytics, Crashlytics, Performance Monitoring etc.)
Does any one know how it can be done? Or if I just missed the documentation where it's described - please, share the link.
Thanks in advance.
P.S.: If someone also knows how to create Google Analytics acc also via REST API or terraform - please, share this info or the link with proper documentation.

Related

Should I use GA4 or firebase to configure my app?

I have added my app to GA4 using data streams. It seems it is associated with a firebase project id. But the project doesn't appear in the "Your apps" section of the Firebase console. If I add my app in Firebase section, it generated a different project id.
So is it necesssary to configure both?
In the Firebase console I got somehow two projects with the same name.
It seems that when creating a GA4 property, it will also create the project in the Firebase console.
To answer my own question, when creating a "data stream" for an app, it will automatically add the app to the Firebase console. If not, that because you are in the wrong project.
I guess that if I had added the app to the Firebase console first, it would have been added to the "Data Streams" section for the GA4 also. (As long as the Firebase project is linked to the GA4 property though)

Consolidating Firebase messaging and Google Analytics in Xamarin Forms Android project

In our Xamarin Forms app we have been using Firebase for push notifications for few years. For that purpose, we have a project in Firebase Console.
Now I needed to add Google Analytics (GA4) functionality. Based on documentation, in https://analytics.google.com/ I created a property for our project, and added a data stream for Android platform (and another data stream for iOS also, by the way). That allowed me to download a config file google-services.json to be added to the app project. A new project corresponding to the newly created data stream appeared in the Firebase console.
The problem is that the app project already has google-services.json file used for the push notifications. If I replace it with the new google-services.json, push notifications stop working. If I leave the existing google-services.json, GA4 would not work.
Of course, the google-services.json files differ. The project_number, project_id, storage_bucket, client_id etc are different, and the existing file has
"firebase_url": "https://api-1234567891482864589-273909.firebaseio.com",
which does not exist in the new file. The package_name is the same in both files.
How can I consolidate the projects to make both Firebase functionalities work? I would prefer to keep the newest project.
From document [GA4] Firebase integration
Link Google Analytics 4 properties to Firebase, we could find that :
Create a project
When you create a project in Firebase, you have the option to
integrate with Analytics. If you already have one or more Google
Analytics accounts, you can associate your project with one of those.
If you do not already have a Google Analytics Account, a new one will
be created for you with the name Default Account for Firebase.
Firebase users who have access to that project are given Analytics
user roles based on their Firebase roles (see User access above).
For more, you can check Part : Link your Firebase project to Analytics in above link.
The steps:
Set up a new Analytics link
Open your Firebase project.
Open Project settings > Integrations.
On the Google Analytics card, click Link.
Select an Analytics Account or create a new one.
If you select an existing account, you have the option to select an existing Google Analytics 4 property in that account or to create a new property.
If you create a new account, then a new Google Analytics 4 property is created for you and your project is linked to that property.
Learn more about setup and limits
Configure your Analytics settings.

Log errors from app on Google Play using Crashlytics

Probably silly question, but is it possible to send errors using Crashlytics from users that downloaded my app from Google Play? Until now I was using Crashlytics to collect errors from my app distributed by Firebase (so it was only for me and invited people). But I have released my app on Google Play and I can't see any errors from devices that downloaded my app in Google Play. I read that when I link my Google app with Firebase I can see purchase and subscription and analytics but no mention of Crashlytics. So my question is.. Is it even possible? Thank you very much.
Is the package name the same on your "release" version on the store? If your test one was called com.patrik.coolapp.debug (which is the default if you're using a debug build) then you'll need to add com.patrik.coolapp as an App in your Project in the Firebase console.
If you already had Crashlytics set up (all the dependencies, added the plugin, FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true) somewhere in your app) then it should just work - here's some advice on testing:
https://firebase.google.com/docs/crashlytics/test-implementation?platform=android
So I finally made it..
I'd like to thanks to #cactustictacs for help.
The problem was that I did not integrate Google Play in project settings in Firebase, although it is saying that it is just for Analytics and Subscription.
Before I integrated Google Play in Firebase I tried to add FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true) .. it did not work, but I believe it could be usefull to someone.
It wouldn't be such a problem, but it is required to have Owner or Admin permissions on both Firebase account and Google Play console account (which I did not have). After I get the permissions, integration was enabled and I could see test crashes in Crashlytics.

403 when using firebase API to create a project (As an owner user, not a service account)

I am trying to create a firebase project using the api. The document for this is here: https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/projects/addFirebase
I have created a GCP project already and I am the owner of this project. I can see my project in a request to:
https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/availableProjects/list . It has a project id of: projects/my-project-id-here
I am making the requests as a owner of the GCP project user account (I am not using a service account!) using Google OAuth 2.0 with the correct scopes (You can try it in the documentation), but I am receiving a response of:
{
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
}
I can create firebase project fine If I go to firebase website directly and create the project there.
Google take 30 days to delete my test projects, so I am restricted to how many times I can try to get this right from scratch. Therefore I am also interested to know how you fully unlink firebase from a GCP project without deleting that project. Removing the service account and disabling the APIs from GCP console doesn't seem to do the trick.
Finally, I do not know if it is relevant but I also have the same user account setup with a developer account on google play and the GCP project is linked up for API access it's created service account granted access. I don't think this is relevant though, as my understanding is that I can setup a firebase project without this.
Hope someone can help!
I've found the solution to this. You cannot use the firebase API to create a firebase project unless you've first accepted the terms and conditions which aren't shown to you until you're in a firebase project (go figure).
Anyway here are some clear steps:
Create a firebase project through the website
Open the firebase project
Accept the terms and conditions for firebase use
Delete the firebase project and enjoy the API now working.
Regarding your interest in removing firebase from a project, this is not supported. The best course of action is to undo the changes that were made when firebase was added, namely disabling the firebase APIs, removing oauth client/brand, removing API keys etc, which you have already done, and it’s the closest thing to deleting the project.

Change Firebase Cloud Message account

I have my android app running firebase cloud message using uat#gmail.com. and now, i need to change the administration to production account bbb#mycompany.com
what i have done, using bbb#mycompany.com to create new project and generate a new google-services.json and replace existing google-services.json i created with aaa#gmail.com
using android studio connect to firebase and show
Firebase: A config file "D:\xxx\xxx\google-services.json" was found, but it indicates a project ID "xxx-1vv" that you dont appear to have access to. Request access or delete the file in order to proceed with the connection process.
anyone could help??
You can transfer ownership of a Cloud (Firebase) product without having to change the way your users user the project. Please read this for details. Note that all Firebase projects are also Cloud projects, so anything you do in the Cloud console applies to Firebase.

Resources