flutter: how to use old google-services.json in new flutter application - react-native

A few years ago I created an application with react-native. In this app, I used the firebase cloud message. Now I recreate this application with Flutter. Both applications have the same ApplicationId.
Now I am trying to use google-services.json that I created for react-native in the Flutter application. After using google-services.json in my flutter project, when I send a message from my firebase console, the flutter app doesn't do any action! Mean not received a message from the console!
Is it possible to use the old google-services.json in the new Flutter app with the same ApplicationId?

Related

Will an Android app only receive push notifications is the app was downloaded from the Google Play Store? (React Native Expo)

I'm using Expo push notifications. Push notifications work fine in Expo Go and for apps on published to the Google Play store. But when I create an APK file and download it directly onto my Android phone, NOT through the Google Play store, the push notifications I send are not received.
Will push notifications only work for apps published to the Google Play store? Or is there a way to receive push notifications for apps downloaded directly onto an Android phone without being published to the Google Play store?
Depending on your android version and rom you have to open the app setting's (for me long press app icon).
Select settings
Choose notifications
Enable notification for this app
I forgot to import { Platform } from 'react-native'.
Also, I needed to upload Android server api key credentials which can be found in Firebase Console in your project settings under Cloud Messaging. Here is how to upload the server api key credentials in the terminal:
expo push:android:upload --api-key <your-token-here>
Documentation can be found here under "Uploading Server Credentials": https://docs.expo.dev/push-notifications/using-fcm/

Creating native Android push notifications for App built with PWA builder

Successfully created an Android app of my PWA using PWA builder.
Also Added web push notifications with the Service worker and web Firebase messaging API.
But due to certain shortcomings of web push notifications, I want to use the native push notifications using firebase SDK for Android instead.
Reading a few of these answers How to use push notification for trusted web activity, Cannot understand how to open a simple TWA inside an app (using AndroidX) gives me the impression that I need to have access to Main Activity and put Firebase onMessageReceived inside onCreate function.
But given PWA builder is a Node application that builds APK, I don't know where to start. I understand that I have to 1. Include the Firebase SDK & 2. Put onMessageReceived
But how to go about it using PWA builder?
Or Is it not possible at all? I need to create a brand new Andriod studio project and add TwaLauncher, from android-browser-helper as some of the answers mention?
Also posted this question on PWA builder issues.
When you are generating Android APK, enable the "Notification Delegation" option.

FCM: Mismatched Sender Id when trying to send notification to Expo app

I have a backend that send fcm to web app and expo apps. Double checked all the credentials. But still unable to get it work. Both of the credentials are under same project. Backend is using firebase admin, with service account. Front end is using google-services.json. Anyone encountered this?
Found out that the device token from expo-notification can only be used on standalone build. But not in expo-client during development.
https://forums.expo.io/t/using-fcm-as-push-notification-with-expo-client/42402/2?u=cyee
This is the copy paste comment by expo team.
Hi! If you want to send notifications directly through FCM, and not
through the Expo notifications service, you’ll have to test in a
standalone app (as in, an app you built with expo build:android). This
is because you don’t have the push credentials for the Expo client
app, only we do :slight_smile:
If you want to test in the Expo client app, then you can do that with
Expo’s notifications, which you can read more about here-
https://docs.expo.io/push-notifications/overview/

What Application type of Google Oauth when developing React-Native app

I'm working on React-Native app and my application should be working on both IOS and Android Platform. I need to add feature of signing through Google. So which application type should I choose on create client id page?

Generate google-services.json for firebase via API

Since we've upgraded from GCM to FCM we have a problem because the app suddenly needs a custom google-services.json and I don't seem to find a API or cli tool which enables me to add new apps and generate a new file.
Has someone found a way to automate this?
There is currently no API to generate a google-services.json. You can download it from your Firebase Console by selecting your project and then clicking to manage your Android app.