FCM backend with Google Cloud App Engine - android

I want to use FCM & Firebase Realtime DB to allow messaging between users. The Realtime DB will work as a chat and the FCM messaging will be used to send notifications in case the other user app is not active.
I need a backend module, I want to use a Google Platform App-Engine with Android Studio. Is it possible to use the Standard App Engine to look for notifications request in the Realtime DB and then send messages through the FCM API (HTTP Post)? or do I have to implement the Flexible App Engine?
Thanks for your help,

you can use the Firebase Java API in App engine
this example is pretty close to what you are trying to do it sounds like
https://cloud.google.com/solutions/mobile/firebase-app-engine-android-studio

Related

xamarin android real time notifications app uber similar

I'm developing an application on Xamarin Android similar to uber but I need to make real-time notifications of travel request, cancellation and location, any idea how to do it?
There are several choices you can choose:
1. Firebase
You can to use Firebase to provide real-time notifications.
By using only two Firebase features, you can create real-time notifications for users: the Firebase Realtime database for web users , and Firebase Cloud Messaging for Android users.
What the Firebase Realtime database provides us with is the ability to save, retrieve and sync our data with our NoSQL cloud database. We can sync data across all clients in real time. The Firebase Realtime Database is simply a cloud-hosted NoSQL database and the data is stored as a JSON and synchronized in real time to every connected client.
For more details, you can check: https://www.atlantbh.com/blog/using-firebase-provide-real-time-notifications/
2. SignalR
Azure Mobile Services has SignalR integrated, and Azure Mobile Services provide a SDK for client apps, I suppose it is provide out-of-the box.
You will find many capabilities included in Mobile Services and
readily available for your Web API. Mobile push notifications,
real-time notifications with SignalR (auto-scaled out), social auth
for your consumer apps, offline data sync for occasionally connected
scenarios, to name a few.
For more details:
https://visualstudiomagazine.com/Articles/2013/11/01/How-To-Use-SignalR-in-iOS-and-Android-Apps.aspx?Page=2
https://blogs.msdn.microsoft.com/azuremobile/2014/05/30/real-time-with-asp-net-signalr-and-azure-mobile-net-backend/
https://azure.microsoft.com/zh-cn/blog/azure-mobile-services-why-should-asp-net-developers-care/#HighValueCapabilities
Samples:
https://github.com/gshackles/RealTimeGallery
http://saramgsilva.github.io/NotificationHubs/
3.PubNub
Live Notifications of it keep everyone, and everything, realtime with live notifications across HTTP, SMS, FCM, APNS2 and more.
For more: https://www.pubnub.com/solutions/live-notifications/
4. Pusher
PubNub and Pusher are all offerring real-time infrastructure as a service and all the benefits that come with that. Both of these solutions are pub/sub. Pusher also offers an additional event abstraction: Evented PubSub.
For more: https://www.pubnub.com/developers/

How can I automate sending push notification when an event occurs in back-end of android app provided I'm using Firebase as Backend

Consider a whatsapp group. When any user texts in group, all the participants receive a notification.
Consider Youtube, whenever a content creator uploads a video, I get notifications.
These are all automated.
How to do this? I use Firebase as backend in my android app.
You need back-end services that you communicate with through an Api from your app. Think of this as a communication layer between Firebase and your app.
Generally this can be considered as a REST API. Here is more reading:
https://restfulapi.net/rest-api-design-tutorial-with-example/

Android chatting app development

I want to make an Android app where there will be several clients and an admin.The app will be installed in client's device.Admin can be send message from computer to the clients and clients could be reply the message.
The admin could be also send notification to the all clients or to individual client.
Can anyone give me some suggestions that which technologies should i use to build such an app?
You need to build a backend for your app with a database to store user informations , messages etc... I suggest you to use a non-relational database because access to db values it's more efficient for this uses-case.
To make it easy you could try Firebase Cloud Messaging.
Here the official site
Firebase
You can use the Firebase which provides you a bunch of products like notification, authentication,cloud storage, cloud messaging, Notification. You can easily integrate this in your app by just following the documentation.

What exactly is Firebase Cloud Messaging?

I need to retrieve data from firebase database while app is in background or closed. For this, I have been thinking of using database reference in a service.
Instead of this, people recommend using Firebase Cloud Messaging. But what exactly is that?
How does is interact with the database? How do I use it for listening and retrieving data? There are very little explanation on these and firebase docs are too broad. Or maybe I just cant find it
But what exactly is that?
Firebase Cloud Messaging (FCM) is the latest version of Google Cloud Messaging (GCM), which is Google's Push Notification Service.
It allows developers to send data from their App Server towards the Client App. For your case, you may be able to send over the desired data towards your Client App, by integrating your Database with FCM.
How does is interact with the database? How do I use it for listening and retrieving data?
If you are using Firebase Realtime Database, you may choose to integrate with FCM in such a way (referring to #FrankvanPuffelen's answer):
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?
In summary, you don't use it to listen for data. You can however use it as the medium to send the data from your Database towards your Client App.
Since you are implementing Firebase for the first time, I'd recommend you to go through this and get a basic idea about it.
Broadly, FCM (previously GCM) is a Cloud Messaging service for your app. Most importantly, the Analytics and Realtime Database of Firebase are used.
Here is a link to their docs. Go through it for better understanding of Firebase and its implementation.

Push Notification using Firebase and Google Cloud Messaging

I want to send push notification in my app (Android) using Google Cloud Messaging. I am using firebase for backend. As firebase do not support inbuilt push notification i am using Google App Engine.
I do not have any idea on Google App Engine. Right now i am using a template provided by google for sending push notification.
Google Cloud Messaging Template Github
Till now i have deployed my app in Google App Engine and i am able to send push notification to all devices that are registered (From Web) An HTML page i get when i use GCM template.
What i want to do is , to Listen for Firebase data change and send push notification to user who is not online or has closed the app.
How can i run a servlet in background so that it keeps running in background and send push to user who is not online/connected.
As i have only push notification logic in Google App Engine Should i use servlet or struts.
Thanks in Advance
It is my understanding that Firebase really doesn't work very well with GAE, so you might want to reconsider your choices.
Listening for data changes, as you have mentioned, requires that your app leave a background thread running. To do this on GAE you have to disable automatic scaling which is an important feature of GAE.
You could create a separate backend GAE module with manual scaling and then have it use eg. a queue to notify your main GAE module of a data change, but this seems to me to be unnecessarily complicated and inefficient.
Hopefully Firebase will improve their product so it can notify of data changes in a more efficient and flexible manner, but in the mean-time, perhaps you should use a regular compute engine instance.

Categories

Resources