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
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
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.
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
Is it possible to create new hosting projects by API, or another non-interactive method on Google Firebase?
I already tried Firebase tools with a token, but it says that it is only possible to create a new project on Firebase Console.
Some context:
My project allows users to create static websites online and we are searching for solutions to host these sites. Firebase would be a great solution, but only if I could integrate the user's new project into my system, with Firebase projects.
Updated (2018-11-07)
It is now possible to create with the Firebase Management API. Through this same API you can get a list of projects, add an app to an existing project, and list the apps in a project.
Hi!
public static void AddFirebase()
{
var request = new AddFirebaseRequest();
var operationFirebase1 = _firebaseManagementService.Projects.AddFirebase(request,
"projects/" + CloudManager.ProjectId).Execute();
WaitOperation(operationFirebase1, "Firebase");
}
My sample creating a new Firebase project by API:https://github.com/Denys2211/Firebase-cloud-messaging
I am using the Android SDK to send data to Google Analytics. In this project I cannot use Firebase nor GTM. I should send hits directly to GA. I have already implemented everything, events included. But I cannot create Content Groupings. I think that the follow code is deprecated, isn't it?
mTracker tracker = GoogleAnalytics.getInstance(this).getTracker("UA-XXXXXXXX-X");
mTracker.set(contentGroup(1), "Level");
Which is the correct implementation for creating Content Grouping with the Android SDK without using other platforms (I mean sending everything directly to GA)?
Thanks a lot.