I am writing an Electron app, and I am wondering how to connect Firebase Cloud Firestore as the database. I have done some research, but the articles I have read have all been outdated. I want to do this with Electron v15 and Firebase 9; is this possible?
Related
Till now I was using service account to connect to my Firestore database (Firebase is not enabled) from within Google products like Cloud Functions or Colab.
Now I need to connect to Firestore from html page opened in my browser. Is it possible without enabling Firebase?
Yes, the Google Cloud Firestore NodeJS SDK is meant to be used on server side only. You can use Firebase Web SDK along with Firebase Authentication and Firebase Security Rules to support serverless app architectures where clients connect directly to your Firestore database.
You don't necessarily have to use Firebase Auth. However, it might be a good idea to restrict access and allow only public content to be accessible without authentication.
You can follow the quickstart in the documentation to setup the client SDK.
Are all of the Firebase services for Android unable to work on Huawei or is it just the cloud messaging service that does not work? Do all of the firebase services rely on Google Play Services?
Firebase SDKs can be divided into three categories:
Play services required — These SDKs require Google Play services, otherwise they have no functionality.
Play services recommended — These SDKs require Google Play services to have full functionality, but they still offer most functionality even without Google Play services.
Play services not required — These SDKS do not require Google Play services to have full functionality.
List of Firebase SDKs that don't require Google Play services
List of Firebase SDKs that you need to include Google Play services
Remote Config SDK com.google.firebase:firebase-config:20.0.0 doesn't require Google Play Services.
Realtime Database SDK com.google.firebase:firebase-database:19.5.1 doesn't require Google Play Services.
But keep in mind that Realtime Database depends on Firebase Auth (it needs an authenticated user to work) which depends on Google Play Services. For that you can use Firebase Auth REST API instead of Firebase Auth SDK.
For more info Use Firebase Authentication without Google Play services
Update 27 Oct 2020:
Firebase Auth SDK v20.0.0 com.google.firebase:firebase-auth:20.0.0 doesn't require Google Play Service.
Official Dependencies of Firebase Android SDKs on Google Play services
The following Firebase products depend on Firebase Authentication.
Firebase Realtime Database
Cloud Firestore
Cloud Functions
Cloud Storage
You just need to replace Firebase Authentication with Firebase Auth REST SDK. Using this SDK, you don't need to change your existing Firebase Realtime Database code. It will start working on Huawei devices and also GMS devices as well.
Docs: Firebase Auth REST SDK - How to use Firebase Authentication on HMS phones
Firebase official stance is that all Firebase services require Google Play Services to work. Yes, some Firebase services actually work without GPS currently, however this can change at any time without prior notice.
Firebase services will not work on the new Huawei Phones.
For Huawei devices you can take a look to HMS and App Gallery Connect Services
Remote config: https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-remoteconfig-introduction
Cloud DB: https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/clouddb-apply
Push Notifications: https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/push-introduction
To make your app compatible with all devices, you can use the G+H solution:
https://forums.developer.huawei.com/forumPortal/en/topicview?tid=0201200435859940059&fid=0101187876626530001
I know that I could setup Cloud Firestore and GCP Cloud Functions with infrastructure as a code, but I'm interested that it will be shown at the Firebase Console. I also can't find any way to deploy Firebase Auth and Realtime database with IaaC.
Any Cloud Functions deployed by either the Firebase CLI or gcloud will appear in both the Firebase console and the Cloud console.
Any data populated in Firestore will also appear in both consoles.
The Cloud console has no view into Firebase Auth or Realtime Database, as those services are unique to Firebase. You will have to use the Firebase console and its tools and SDKs to work with those products.
In fact, a Firebase project is just a Cloud project with extra APIs and services enabled on top. You might be helped by reading this blog series on the relationship between Firebase and Google Cloud.
https://medium.com/google-developers/whats-the-relationship-between-firebase-and-google-cloud-57e268a7ff6f
https://medium.com/google-developers/firebase-google-cloud-whats-different-with-cloud-functions-612d9e1e89cb
https://medium.com/google-developers/firebase-google-cloud-whats-different-with-cloud-firestore-40f1fc3e6d1e
https://medium.com/google-developers/firebase-google-cloud-whats-different-with-cloud-storage-a33fad7c2b80
I want to take a decision to use Firebase Admin SDK or Firebase Admin REST API.
I need to use it in the communication from Angular/Node.js to Firebase database.
Please let me know if you can share the comparison between this two.
Thanks.
For communicating from an Angular web app with the Firebase Database, use the Firebase Web SDK.
For communicating from a server-side Node.js process with the Firebase Database, use the Firebase Admin SDK.
For communicating with the Firebase Database from a platform for which there is no SDK, use the Firebase REST API.
Is there a way to integrate the Firebase real time database with the newly introduced Firebase Cloud Messaging services ?
I am building an app which uses the the Firebase realtime database for storing data. I want to notify my users using push notifications for every new insert in the database. I came across tutorials which teach you how to use FCM, but most of them require you to set up your own server for storing tokens.
Is there a serverless way of integrating Firebase DB with FCM ?
Sending messages to devices based on inserts into the Firebase Database will require you to run a trusted process, typically on an app server that you control. This trusted process listens to the database changes and then calls Firebase Cloud Messaging to send the messages.
For an example of how to send messaging from a node.js script, see my answer here: How to send Firebase Cloud Messaging from a node server?