I am trying to use 2 different Firebase projects with android, one for FCM and another for Crashlytics(say ProjectA for FCM and ProjectB for Crashlytics). But it's not working for me.
I am initialising Firebase manually.
As soon as my app starts I initialise Firebase for FCM using ProjectA configuration.
val options = FirebaseOptions.Builder()
.setProjectId(fcmOptions[5]!!)
.setApplicationId(fcmOptions[0]!!)
.setApiKey(fcmOptions[1]!!)
.setDatabaseUrl(fcmOptions[2])
.setGcmSenderId(fcmOptions[3])
.setStorageBucket(fcmOptions[4])
.build()
FirebaseApp.initializeApp(this, options)
Till here it is fine, the token gets generated and I am able to receive Push notifications.
After this on click of a button I register for Crashlytics using ProjectB configuration.
val options = FirebaseOptions.Builder()
.setProjectId(crashlyticsOptions[5]!!)
.setApplicationId(crashlyticsOptions[0]!!)
.setApiKey(crashlyticsOptions[1]!!)
.setDatabaseUrl(crashlyticsOptions[2])
.setStorageBucket(crashlyticsOptions[4])
.build()
FirebaseApp.initializeApp(this, options, "crashlytics")
After this step I cause a few crashes so that I can see the crashes in Crashlytics dashboard.
The problem here is that the crashes don't appear under ProjectB Crashlytics console which is what I expect. But the crashes appear under the ProjectA for FCM.
Has anyone tried such scenario before and can help me out.
Crashlytics does not support using a secondary project to capture crashes. It will only use the default project (the one you initialized without a name). FCM and Analtyics are the same way.
Related
I'm using sample code available on connecty-cube GitHub repo. When I call to user who is on android phone doesn't receive the notification for call when app is in background. And when app is open user can see the incoming call. Constructor of PushNotificationsService run and I can see this console [PushNotificationsService][constructor]. But inside _registerBackgroundTasks() function [JSNotifyWhenKilledTask] notificationBundle console doesn't run. I do get UDID for channels APNS, APNS VOIP and UDID for channel FCM in connecty cube dashboard.
So that's how I figured out the problem.
Make sure you have properly configured each step of every required library for connecty-cube.
Follow the docs
After that I checked sdk version of firebase on firebase console.
It stated classpath 'com.google.gms:google-services:4.3.13' in (<project>/build.gradle). But mine was classpath 'com.google.gms:google-services:4.3.10'. And because of that notification was not appearing. Now it's works.
I assume you are referring https://github.com/ConnectyCube/connectycube-reactnative-samples/tree/master/RNVideoChat
I suggest the following:
follow Getting started guide https://github.com/ConnectyCube/connectycube-reactnative-samples/tree/master/RNVideoChat#getting-started and make sure you have google-services.json properly located
Re-check https://developers.connectycube.com/reactnative/videocalling?id=receive-call-request-in-backgroundkilled-state where it describes how BG task works
You are my only hope solving this problem. I have 1 firebase project, and two android applications, one is for the users, and one is for the coaches. I store data in firebase firestore, and my plan is the coaches can upload trainings to firestore and that list appears on the users app, the users then can sign up for training etc etc...but with the second application connected to the firebase project, this error pops up in both applications:
java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process [package name]. Make sure to call FirebaseApp.initializeApp(Context) first.
I have found some infos on internet that says I must use FirebaseOptions.Builder() to initialise one-one separate FirebaseApp instance in each android app, but I tried it and didnt work. This was the code for it:
private fun firebaseInit() {
val options = FirebaseOptions.Builder()
.setProjectId("qrtrainertruck-adminapp")
.setApplicationId("1:221722591872:android:b3964eb554e10b6251dc65")
.setApiKey("AIzaSyCfjNCD5kHb-LnB5FZXKPxi1t0lXJQASB4")
.build()
FirebaseApp.initializeApp(this, options, "adminapp")
}
Maybe just the api key is wrong, or I dont know...If this is the solution then where can I find these attributes (projectId, ApplicationId, ApiKey) for the function?
Thank you for all the help!
you can add multiple apps in one firebase project.
We are starting to migrate from Google Analytics to Firebase Analytics as it is going to be deprecated in a year. We have a need of initializing the firebase project runtime in our iOS application and we are following the steps mentioned here: https://firebase.google.com/docs/projects/multiprojects?authuser=0
Why do we need to initialize the firebase manually and at runtime? The details are in this issue: Switching between different firebase projects (runtime) in one single APK file
I posted that issue when we encountered a similar problem for push notifications on Android because at that time the documentation was not sufficient. It is really good to know that firebase documentation has been updated to reflect how to manually initialize the sdk for various platforms.
Problem: The problem that we are facing today is that once we initialize the SDK manually for say a "secondary" application and we try to use the firebase analytics, it fails with following error:
2018-12-20 17:14:33.526757-0800 App Name[9218:675367] 5.2.0 - [Firebase/Analytics][I-ACS025018] Event not logged. Call +[FIRApp configure]: AppLaunch
Below is the sample piece of code:
FIROptions *firoptions = [[FIROptions alloc] initWithGoogleAppID:#"Actual_GoogleAppId" GCMSenderID:#"Actual_GCMSenderId"];
firoptions.bundleID = #"actual.bundle.id";
firoptions.APIKey = #"actual-api-key";
firoptions.clientID = #"actual.client.id";
firoptions.databaseURL = #"https://actual.url";
firoptions.storageBucket = #"actualapp.appspot.com";
[FIRApp configureWithName:#"testApp" options:firoptions];
if ([FIRApp appNamed:#"testApp"]) {
[FIRAnalytics logEventWithName:#"AppLaunch" parameters:nil];
}
Looking at the error it tells us to use [FIRApp configure] which configures the default application from the GoogleService-Info.plist in the project. But we do not have GoogleService-Info.plist in our project as suggested in https://firebase.google.com/docs/projects/multiprojects?authuser=0.
TL;DR: We are initializing the firebase app manually in our iOS application using the API [FIRApp configureWithName:#"testApp" options:firoptions]; and the Firebase Analytics gives an error asking us to use default [FIRApp configure] which defeats the purpose of manual initialization.
Any help is greatly appreciated.
Firebase Analytics requires the file to be named GoogleService-Info.plist. Note the first paragraph of https://firebase.google.com/docs/projects/multiprojects?authuser=0 recommends differentiating multiple versions of it by putting them in different directories.
More details about FirebaseAnalytics and multiple plist files at https://github.com/firebase/firebase-ios-sdk/issues/230
due to some reasons i've decided to initialize firebase sdk without aplying the google-service plugin and addin the google-services.json file to project.
here is my code in the application class
FirebaseApp.initializeApp(context, new FirebaseOptions.Builder()
setApiKey("val").setProjectId("val").
setDatabaseUrl("val").setApplicationId("val").setGcmSenderId("val").setStorageBucket("val").build());
and in my build.gradle i've added this
implementation 'com.google.firebase:firebase-messaging:17.3.0'
the firebase console does'nt show me any installation after the app is installed, but when i send a cloud mesage using console, it show me the number of devices installed app!,(and also the notification does'nt recieve)
I had the same issue, and the answer to your problem is very easy: You have to call to:
FirebaseApp.initializeApp(...
in your own custom Application's onCreate() method, for example:
public class YourApplication extends Application {
#Override
public void onCreate() {
FirebaseApp.initializeApp(context, new FirebaseOptions.Builder().
setApiKey("val").
setProjectId("val").
setDatabaseUrl("val").
setApplicationId("val").
setGcmSenderId("val").
setStorageBucket("val").build());
}
}
Why? Regarding what this post and this post says about how to have multiple firebase projects and you are not using google-services.json and google-services plugin, your firebase instance is not being initialized and you should initialize it as any other framework in your own custom application class in order to have it at the moment to receive a push notification.
This is not good idea to send cloud messaging without google-services plugin. All your keys inside to Google services json and when you want to send notification to your app, firebase will use this keys. May, if you add in strings.xml your keys, will work but also this not good idea.
Please read this doc: https://firebase.google.com/docs/android/setup
I use fabric-Crashlytics in my android app and initiate it in Application class via
Fabric.with(new Fabric.Builder(this)
.kits(new Crashlytics(), new Answers())
.debuggable(true)
.build()
);
I integrated fabric with gitlab in fabric's service hooks successfully, It means when I press "Send Test" blue button on fabric I'll receive an issue in gitlab.
BUT when I force app to crash via [Crashlytics.getInstance().crash();] ,I don't get any issue in gitlab, Why?
How Can I fix this problem?
My problem solved as I said in comments.Thanks MikeBonnell for the comment:
Mike from Fabric here. What impact level did you choose on the integration? Only if the impact level was set to 1 would a new issue be triggered. Also, this needs to be a brand new issue, that is if you've used that test crash before, then a new issue wouldn't be sent over.