I want to create social networking application whose features will be:
Authentication
Send Messages on newsfeed activity(visible to all the authenticated people)
when somebody comment/likes your message send notification
Followers
Followings
when somebody follows you send notification
Is firebase realtime database enough for this or I have to use firebase cloud function? or AWS dynamoDB or what would be the good combination to achieve desired functionality?
Thanks
You need to use Firebase Cloud Functions to send notification automatically on follow/comment/like.
All what you need is Firebase.
AWS is pretty much harder to init than Firebase.
You can see here some samples of using Firebase Cloud Functions.
This sample will help you to send notifications on follow/comment/like.
Related
The Firebase Console allows us to send notifications to single users, groups, users subscribed to topics or to the entire user base. Is there any code that allows us to directly send notifications in the same way, but programmatically?
For example, if I had a list of users (containing their Firebase UIDs), if I click on one of the users, could I send a notification to that user through Firebase the same way the console allows us to send a notification through the console?
This Firebase Blog uses the Google App Engine Flexible Environment to actually send the notifications, but it requires a free trial and costs money.
This Quickstart doesn't really show how to send user to user notifications. It focuses on the subscription-based notifications, but this isn't really what I need.
Is there any good way of doing this with Java/Kotlin and the Firebase API?
FCM doesn't support you sending message directly from Android app to Android app. However, this is a workaround to solve your problem:
Create a firebase cloud function. Listen a special path in firebase database
Android app 1 push a data (maybe Android app 2 ID) to this path
Firebase cloud function process data, determine who to send notification (Android app 2).
Firebase cloud function push notification to Android app 2.
ref: https://firebase.google.com/docs/functions/use-cases#notify_users_when_something_interesting_happens
In a basic concept: we write our server to get action from firebase database and decision to send notification to other user by FCM. This our server can write with NodeJS or using Firebase Cloud Function (above)
Guide how to using Nodejs is here: https://firebase.googleblog.com/2016/08/sending-notifications-between-android.html
I am trying to create an android application and would like to use firebase database. As I read firebase allows instant messaging and also notify clients when database is updated. I need to create a database and when any database changes happen, related users needs to be notified only. Is that possible with firebase or should I use backend server for this purpose?
You can do it using the Firebase only.
What you needs are
Firebase Database (Realtime database/Firestore)
Firebase Cloud Functions
Firebase Cloud Messaging (FCM)
You should write two side codes:
Client side (Android)
Server side (Cloud Functions)
In Client side (Android)
You should register token. (To send a notification using the FCM, Token is needed.) You can do this easily (https://firebase.google.com/docs/cloud-messaging/android/client)
I recommend that you can store the token into the database/firestore too.
for example:
class User {
long id;
String email;
String token;
}
You may write the code to modify the database/firestore.
Implement receiving code (https://firebase.google.com/docs/cloud-messaging/android/receive)
In Server side (Cloud Functions)
Add some trigger to the database/firestore.
Get the token from the database/firestore
just send FCM message (https://firebase.google.com/docs/cloud-messaging/admin/send-messages)
You can get the sample code for Server side (Cloud Functions)
https://github.com/firebase/functions-samples/tree/master/fcm-notifications
Yes you can achieve this using Firebase Cloud Functions which:
lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. Your code is stored in Google's cloud and runs in a managed environment.
And with Firebase Cloud Messaging which:
Is a cross-platform messaging solution that lets you reliably deliver messages at no cost. Using FCM, you can notify a client app that new email or other data is available to sync. You can send notification messages to drive user re-engagement and retention.
So you can write a function in Firebase Cloud Functions which will trigger a notification every time something is changing in your database. Both documetations are very well explained.
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.
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
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.