Android - firebase cloud messaging, two apps in one firebase project - android

I have two android applications. I am using only one firebase project for both of them, with both applications included in it. So I have only one google-services.json with specified keys for both my applications. I am trying to use firebase cloud messaging and I am experiencing following problems:
When I want to test cloud messaging from firebase console I am able to choose to which appId I want to send a message. I have both applications installed on my device. Both are working normally. I have also released them to google play (alpha testing) and everything went well. I am able to download them from store normally. AppId should be set properly (how can I check that?). Problem is, that when I choose the first app in firebase console I am receiving notifications from both apps and when I choose the second app I am receiving nothing.
What can cause these problems? Do I need to create completely new firebase project for the second app, too? Or am I missing something?
If you need to see some code, let me know. At this point I don't know what piece of code could tell you more about my problem.

It looks like you have used same google service json file on both your apps. So thats why sending cloud notification for one app is received on both apps while in second case since no app has the json file for that there is no notification.
Go to your firebase project settings and download the google services file for both app ( you should first download one and move that file to desired project then download second services file).

Related

Firebase invalid credentials on Android

That's my concern, currently I'm developing an application that uses Firebase. Recently my identifiers for Android no longer work, the error tells me that the App ID does not match, however I am using google-services.json provides from my firebase console after adding my android application with its SHA key- 1.
My file is inside android/app folder like Firebase want it.
I have no problem with my iOS application, everything works fine.
Do you think I should try to delete Android ID clients OAuth 2.0 from google cloud platform and try to recreate it ?
it works, delete and recreate everything works, because Firebase works independently : if you delete an app inside your firebase console, it doesn't delete it inside google cloud platform.

Can I automate to create android app to firebase project?

My application has many flavor that has different application id. I want to register these applications to create to Firebase project.
I want to automate below process:
Create android application in Firebase project.
Enable crashlytics for the applitaion.
Download google-service.json of the project.
Firebase Management API seems to be able to first one, but other can't. I try using puppeteer to control Firebase console in browser, but google prevent to log in by automated browser.
Is there any other solution?
To download google-services.json, you can call projects.androidApps.getConfig from the management API.
For the second one, it's currently not possible. Contact Firebase support to file a feature request.

Android Firebase Auth: is "google-services.json" still required?

I have an Android app which uses Firebase Auth, and while fixing some issues I had, I noticed that there is no need to add the file google-services.json to the project.
My issue was the following. I perform a sign-in via Google Sign-In, and in the GSO (Google Sign-In Options) I specify
gsob.requestIdToken(".....apps.googleusercontent.com");
gsob.requestEmail();
because I want an idToken which I then can pass to the Firebase SDK in order to sign the user into Firebase (I'm using it this way for historical reasons).
It had stopped working which was the reason why I was meddling around with the google-services.json file, since I had deleted a Client-ID in console.developers.google.com and thought I made a mistake.
While being at removing stuff, I also removed an entry
<meta-data android:name="identitytoolkit.server_client_id" android:value="....apps.googleusercontent.com" />
and some more identitytoolkit metadata entries from the Manifest.
In the end the only thing that would matter was that the correct client-id is passed to gsob.requestIdToken(".....apps.googleusercontent.com");
I'm not sure if Google had some hiccups with the idTokens between Google Sing-In and Firebase during these last two days, but in the end I think I really didn't change anything to make it work again.
So the last couple of minutes I was reading through the Firebase documentation, and read that there are now two options for adding Firebase to an Android app, one is the one I used before, and then there's a new option to use the Firebase Assistant.
I never used the Firebase Assistant, but am wondering if it has been enabled automatically in my app (I never clicked "Click Connect to Firebase to register your app with an existing or new Firebase project and to automatically add the necessary files and code to your Android project.")
How can I find out if something in Android Studio has been altered to add my Firebase configuration automatically? Where do I know which client-id's it's using?
I'm asking because even the email-based authentication with Firebase (which is not using Google Sign-In explicitly) is working in the app, and there are is no json file or other client-id's in the Manifest or in the code which could be used for this.
Nothing has changed in the setup instructions. You either need to have the Play services plugin and google-server.json present, or you need to duplicate its work manually. The only ways to manually duplicate its work are to add the specific string resources to your app that it requires, or call initalizeApp with your specific settings. There are currently no alternatives.

Firebase with dynamic applicationId

I am maintaining a website where people can customize an Android application and download as an apk file.
I need to implement push notifications. I had it implemented in Google Cloud Messaging before. But I am moving to Firebase now.
The problem is that Firebase is configured with specific application ids through google-services.json configuration file. But I need it to run with automatically generated application ids.
I have already tried to change the id in the configuration file. It compiles, but notifications are not delivered.
Please, can anyone tell me if there is a way to make it work?
Edit:
I don't see how my question is related to an Android Datepicker question with nothing to do with Firebase.
There is only one way, you need always create new android app per every unique app id in firebase console. Then download and build new app instance with generated 'json'. Unfortunately, firebase does not provide any API for automatization this, and you have to do it manually every time.

Add new updates on Android App

I am a beginner on Android as I am working on developing a new Android app. In my project I have some problems when the user click on an icon, it should redirect him to dot net website I did in my code.
If I want to update the apk file on customer mobile to update it should prompt to the user to download the new version. How can I achieve this?
Also how can I know this app belong me between many app on customer device?
I want to fetch the bugs and errors that may occurred on the customer device. How can I do it?
2.
If you release your app in the Google Play Store the updates are managed automatically by Google. You can just release another version of the app in the Google Play Store and all users will be notified from Google that a new version is available.
3.
If you release your app in the Google Play Store bugs will be reported automatically by Google to your Google-Mail Account.
Better to implement GCM push service in your application to send a notification about the update to all your application users.
http://developer.android.com/guide/google/gcm/index.html
This framework will give your application to support push notify the user from your server, and what you need to do in your application just track the received push and write a code to download new APk from server and install it automatically.
The second thing you asked about the Crash reports so the best option is use ACRA technology to get the your application report on server everything force close or logcat
Both are very easy to implement so enjoy!!
At first use GCM for push notifications like updates for your application.
Second useGoogle Analytics for any bug report crashes usage

Categories

Resources