Connecting a Java desktop app to Firebase-analytics - firebase

I have three types of clients that work with my server at the moment: Android, Web (Angular) and а Desktop-application written in Java. There is a need to send events to Firebase-analytics from each client. I am clear on how to send events from Android and the Web - this is described in the documentation. But i can't find the way to send events from desktop-app. So, i have several questions:
Is this option possible?
Maybe the answer, is to send events to BigQuery? So, what is the difference between sending events to Firebase-analytics and BigQuery (via the REST API or using client libraries) associated with Firebase-analytics?

There are only client libraries for web and mobile apps. Desktop apps are not supported.
You could certainly have your desktop app send data to BigQuery, in order to augment existing data from Firebase that you export to it. If you do this, you will have to create your own queries to analyze the data - the Firebase console will not be able to see the data you put there directly.

Related

Secure communication between Flutter App and Web PHP

I'm learning Flutter myself and need some expert guidance on the right way to do what I want.
I would like to allow the user of my Flutter application to securely send some sensitive data (e.g. email, phone number, name etc.) to my PHP based website (with REST API) and then, after some time, I would like to send a reply (e.g. . text) from my website to the sender's device and displaying it on the User's screen.
I suspect I should use Firebase Cloud Messaging for this - am I right?
I found tutorials that explain how to send data from Flutter-> FCM and from PHP(curl)-> FCM. But I can't find the tutorial explaining how to send data from Flutter-> FCM-> PHP?
Firebase Cloud Messaging is typically used to send messages from the server to the application, when the user may not be actively using it. While it can be used to send messages from the client to a server, it is much less common for that.
That's because calling a PHP API from your Flutter app is no different than retrieving any data from the internet, and can be accomplished in a multitude of ways. One of the simpler approaches is documented in Flutter's fetching data from the internet page and uses the http package.

Should I make a RESTful API using Cloud Functions or call Firebase and Firestore in app?

I am currently creating a marketplace mobile application from scratch and I'm using React Native for the front-end part and Firebase for the backend (using Firebase and Firestore).
I am wondering wether :
I should create a RESTful API using cloud functions and express to create API endpoints (that would connect to firebase and firestore) that I'd call from my redux actions in my React Native app (using redux thunk).
or, I should call firebase and firestore directly from redux actions.
I see couple pros and cons for each method.
Restful API pros :
Safer as I can check and manipulate submitted data more easily
Custom API reply (I can manipulate the return data)
Restful API cons :
Probably slower as I would have to call an API endpoint that will then call firebase and/or firestore.
Won't be as easy to set listeners on firestore data
What do you think about it ?
Which option should I choose knowing that I predict that the app will get a few thousand users daily. I want it to be as fast and safe as possible and be able to set listeners for notifications purposes.
In my opinion you should mix them, if you have to manage users, products or etc. Firebase produces client and admin sdk that has different roles. If you haven't need manage any data of products or users or etc. you can simply use client sdk.
My advise is you can use admin sdk on API (server-side) and feel free to use client sdk on your clients.
Use as managements on API, listening data, realtime chat etc. via client sdk.
You can check admin and client sdk. Also npm packages for React Native here.
Mixing will be of help, you can try:
Listen for small amounts of data using the client SDK
Write and sort data using the cloud functions
In my experience, writing to a firebase database that uses ordered ids (in my case) leads to some huge problems in the long run. I lost a good chunk of data when my app accidentally wrote to a root index instead of a child index when the app was resumed from inactivity because the android system cleared the RAM.
Also, for notification, use Firebase Cloud Messaging.

React Native Notification Websockets v/s Firestore listener v/s SSE

I am developing a mobile app using react native. My backend application is developed using springboot. My app talks to backend using REST.
I want to send some notification to the user of the app from my backend (via one of the options mentioned below). This cannot be a Push Notification as user can disable push notification for my app.
On recieveing this notification the app will communicate with backend using rest api's to fetch more details and complete the transaction.
I want to know what would be a better strategy to send a notification for the user.
Websockets
Using Firestore event listener(since I am already using Firebase to send Push Notitification for users who have enabled it)
SSE(server sent events)
Periodic polling from the app to backend (I do not like this approach)
I know this is a bit broad topic. I just need some pointers as to which option is better in terms of fault tolerance, performance and scalability.
I want to know how this is generally implemented. I am new to app development.
In my opinion Firebase is the best option for mobile apps, websocket can be be closed by android and are not always controllable. They also consume a lot of energy which can drain phone battery.
I have the same requirements for a project where need to send notification regardless of using a third party application like Firebase. How I achieve this I will share with you may be it will help you.
Backend -> ASP.NET Core
Real time communication -> SignalR Core
Protocols -> Websocket, Server sent events, Long Pooling
RN Package -> react-native-push-notification
It was completely fine except for one drawback that it will only communicate and send push notification when app is running (background/foreground) I think it depend on your situation and your requirement if your app is continuously will in the main app this will work for you otherwise you need to use the third-party service like Firebase and it will also work when your app is not running just need to be connected with the internet.

Read Notification via web

I want to implement a push notification service. The idea is to use the GCM Service. Is it possible to read the notifications both via web app (the app is written in php using laravel) and via mobile app for the authenticated users using the same technology?
I think it is possible, I also see this tutorial that can help you to achieve that. It also use PHP as a sample, so it seems like your work will be easier:)
It explains here the basic steps that you need to achieve push notification. It has a sample code and a screenshot to make you understand more the content of this tutorial.
In developing this application, it involves two parts, a GCM Server Application that create Web application using Php to send message to User via GCM Cloud server and GCM Client Application that create Android application which receive messages sent from GCM Server Web App.
For more information you can also check this links:
Implementing Push Messaging for Chrome
How to send push notification to web browser?

How can I create push notifications to a phone application from a server for a single targeted phone (cross platform)?

So my requirements in mind are I have an application continuously running on a phone and I need to be able to push events to this application from time to time.
The application will primarily pull data from the server but sometimes the server will have urgent data it needs to send to the phone. I also have as a requirement to send the notification to a very specific phone, which the application will have a unique identifier associated with that phone. So I'm not looking for a simple broadcast solution.
Polling a web service by the application on a frequent time interval seems like it would impact a data plan too much, plus battery usage of the device. So I'd like to avoid a polling solution if possible.
What would be a good way to accomplish this?
I recently used PubNub to send push notifications to a web app in lieu of Web Sockets. PubNub has SDKs for all sorts of languages. Their long polling method is extremely fast and efficient. You can map messages to different devices based on the UUID of the channel. At first it seems like a simple broadcast solution (and Pubnub can be used this way), but we were able to create unique sessions with a relative amount of ease.
http://www.pubnub.com/developers/
I do not quite understand if you want to build the application yourself or if you are looking for one.
I use Pushover to do this. Pushover runs on Android, iPhone, iPad, and Desktop. It supports multiple message priorities. You can do a http POST with a unique ID and message to send a message to a unique device.
Pushover has it's own API and is really easy to use.
Polling can indeed be costly in terms of data and battery. The most efficient way to send data from the server to a phone is using Push Notifications (iOS) or Google Cloud Messaging (Android). Both notification types can be implemented directly by the developer or by making use of an API.
Golgi is an SDK that produces custom type safe communication APIs. The APIs produced have full support for both Push Notifications and Google Cloud Messaging.

Resources