Where can I find the API KEY for Firebase Cloud Messaging? - firebase

I am trying to figure out how the new version of GCM or Firebase Cloud Messaging works so I moved one of my projects to the new Firebase console, If I did not have the API KEY or I want to create a new one... where can I do it?

It's in https://console.firebase.google.com/project/(your-project-id)/settings/cloudmessaging
You can find the API KEY in:
(gear-next-to-project-name) > Project Settings > Cloud Messaging
Server Key is the API key.

STEP 1: Go to Firebase Console
STEP 2: Select your Project
STEP 3: Click on Settings icon and select Project Settings
STEP 4: Select CLOUD MESSAGING tab

You can open the project in the firebase, then you should click on the project overview, then goto project settings you will see the web API Key there.

Enter here:
https: //console.firebase.google.com/project/your-project-name/overview
(replace your-project with your project-name)
and click in "Add firebase in your web app"(the red circle icon) this action show you a dialog with:
apiKey
authDomain
databaseURL
storageBucket
messagingSenderId

1.Create a Firebase project in the Firebase console, if you don't already have one. If you already have an existing Google project associated with your app, click Import Google Project. Otherwise, click Create New Project.
2.Click settings and select Permissions.
3.Select Service accounts from the menu on the left.
4.Click Create service account.
Enter a name for your service account.
You can optionally customize the ID from the one automatically generated from the name.
Select Furnish a new private key and leave the Key type as JSON.
Leave Enable Google Apps Domain-wide Delegation unselected.
Click Create.
This might be what you're looking for. This was in the tutorial on the site

Please add new api key from Firebase -> Project Settings -> Cloud Messaging -> Legacy Server Key to the workspace file i.e google-services.json

You can find API KEY from the google-services.json file

Click on Project Overview -> Project Settings,
Then click on Cloud Messaging,
Then click on three dots to the right side of Cloud Messaging Api(Legacy) and enable it,click on, to view image
4. Come back to Project Overview -> Project Settings -> Cloud Messaging, here you will get the Server Key

If you want to get the current api key programmatically in android studio, use
FirebaseOptions.fromResource(context).getApiKey()

Click on Project Overview -> Project Settings
Copy your web api key

Once you just go to autherization section it will generate and also make sure enable legacy if need
Web api key is not generated in firebase while creating a new project as stated on the documentation

You can also get the API key in the android studio. Switch to Project view in android
then find the google-services.json. Scroll down and you will find the api_key

Related

Setup Firebase Remote Config

I want to use Remote Config in a application Xamarin.Forms.
I use a blog - Firebase Remote Config in Xamarin Forms
I have a question about the section: Setup Firebase Remote Config.
Quote
We can setup Firebase Remote Config through the Firebase portal https://console.firebase.google.com/project/Your-Firebase-Project/config and it is an easy process because the portal GUI is nice and friendly. To do it, we add a new parameter key and the default value and of course it can be a json (the GUI has a tool to validate the format of the json content). In the example case the key will be Features and the default value a json:
{
"ShowPlayerDetail": false
}
In this case, we setup a key called ShowPlayerDetail to show or not the player detail.
Question:
Where is the JSON file referred to in this section?
Note.
I am currently in a project.
Update-1
Update-2
Update-3
Update-4
Update-5
I have completed the following steps.
Did I do the right thing?
Do my actions correspond to what is described in the blog?
Or do I need to perform Publish changes? (see Pic-4. Result)
Pic-1
Pic-2
Pic-3
Pic-4. Result
You're using an existing Firebase project but there are no apps in your project, please see the Update-4 screenshot .
You could click the iOS or Android icon to add app to your Firebase project, and make sure the Apple bundle ID matches the Bundle identifier in info.plist of your Xamarin.iOS project, the Android package name matches the packagename in AndroidManifest.xml of your Xamarin.Android project. After registering the app, you can download the google-services.json file for Android and the GoogleService-Info.plist file for iOS.

Firebase and Google Analytics - missing measurementId?

I have a few Firebase projects on which I use Firestore and Firebase Storage.
I want to start using Google Analytics and I see this page with all the instructions. The key setting being the parameter "measurementId".
So, following the instructions, I go to my project settings and find the config snippet but unlike in the instructions it does NOT contain this parameter...
How do I generate it?
The solution came from Firebase support, my project needed to be "relinked" to Google Analytics.
Relink your Firebase project to a Mobile App property
If you had
previously linked your Firebase project with your Analytics account
but are no longer able to locate your Firebase project in Analytics:
Open your Firebase project.
Open Project settings > Integrations.
Click the Analytics card to link Analytics to your project.
More details here
I experienced this also. It seems there is a bug in the website. Set up Firebase CLI and run the following command.
firebase --project <project-name> apps:sdkconfig
It should output something like the following:
? Select the app to get the configuration data: Web - 1:686396208177:web:5119a766dc890b7d671110 (WEB)
✔ Downloading configuration data of your Firebase WEB app
// Copy and paste this into your JavaScript code to initialize the Firebase SDK.
// You will also need to load the Firebase SDK.
// See https://firebase.google.com/docs/web/setup for more details.
firebase.initializeApp({
// ... snip ...
"measurementId": "redacted"
});
It includes measurementId.

How does one upload the dSYM via fastlane to Firebase Crashlytics

Does anyone know how one uploads the dSYM via fastlane to Firebase Crashlytics
There is documentation here https://docs.fastlane.tools/actions/crashlytics/#crashlytics
But I am unaware of where to get the apiToken, and this seems to be more Crashlytics without Firebase focussed
Thanks
The crashlytics fastlane action uploads builds to Fabric's Crashlytics Beta, which is used for beta testing apps.
It sounds like you're actually looking for the upload_symbols_to_crashlytics action to upload dSYMs to Firebase Crashlytics.
Using the upload_symbols_to_crashlytics action you can specify the GoogleService-Info.plist (gsp_path) path and that should work.
You can find the API token in your organization's settings page but you must be an admin to view it.
Documentation - https://docs.fabric.io/android/fabric/settings/api-keys.html
Link to organizations page - https://www.fabric.io/settings/organizations

Unlink an existing firebase app?

I want to "Link to new or existing Firebase project & app"
but the crashlytics dashboard told me my project is already linked,
how to unlink my existing project ?
To unlink your Fabric app from Firebase, follow the following steps:
Go to The Firebase project settings
Go to Integrations
Select the Fabric "Manage" link
Click the "Unlink Fabric App"
Very late but if someone still having this problem:
1- try to unlink on firebase dashboard as explanined in this response: https://stackoverflow.com/a/49229545/5679560
2- if the option to remove fabric doesn't appear use this direct link
https://fabric.io/remove_firebase_crashlytics?clientId=CLIENT_ID&projectId=PROJECT_ID
CLIENT_ID is your Firebase Client ID. This begins with "android:" or "ios:" and is followed by either your package name (Android) or bundle ID (iOS)
PROJECT_ID is your app’s containing Firebase project ID, which can be found by going to Project Settings. This is also present in the URL of your Firebase console, i.e. https://console.firebase.google.com/project/
you can check more info in this answer https://stackoverflow.com/a/50003432/5679560

Is it possible to configure Firebase analytics without google-services.json configuration file?

I would like to use Firebase analytics for one of my library modules. I would like to program in such a way that configuration file (google-services.json) should be accessible from either client app folder or configure the same from the client side.
Is there a way I could implement the above mentioned scenario?
Thanks in advance.
You can initialize your library project configurations manually as below,
For more info, kindly refer working-with-multiple-firebase-projects-in-an-android-app
Also go-through how-does-firebase-initialize-on-android to understand; how the Firebase module is getting initialized by itself.
For Android apps using Firebase, there is a central FirebaseApp object
that manages the configuration for all the Firebase APIs. This is
initialized automatically by a content provider when your app is
launched, and you typically never need to interact with it. However,
when you want to access multiple projects from a single app, you'll
need a distinct FirebaseApp to reference each one individually. It's
up to you to initialize the instances other than the default that
Firebase creates for you.
FirebaseOptions options = new FirebaseOptions.Builder()
.setApplicationId("1:530266078999:android:481c4ecf3253701e") // Required for Analytics.
.setApiKey("AIzaSyBRxOyIj5dJkKgAVPXRLYFkdZwh2Xxq51k") // Required for Auth.
.setDatabaseUrl("https://project-1765055333176374514.firebaseio.com/") // Required for RTDB.
.build();
FirebaseApp.initializeApp(this /* Context */, options, "secondary");
Hope I've answered your question.
I've found interesting workaround. Try the following:
put your google-services.json to any sample app google provides for Firebase integration. Compile it.
Take a look on path app/build/generated/res/google-services/debug/values/ there should be generated values.xml file with bunch of strings mentioned in errors you described. Copy these strings to value.xml file of your project. That's it.

Resources