Hello everybody I am making a real time chat app based on flutter. I am using Firebase as backend of my app and the sample texting is working awesome. But I want to add an active feature for the chat, like when user is active, on the app for the other user he had an early conversation with him, he is showing that he is currently active, and a green light shows up like in messenger or viber or what app. Can I do it with flutter and firebase?
What you're describing is what's known as a presence system, which can be implemented on Firebase's Realtime Database by combining its .info/connected node and its onDisconnect handlers. For full details see the Firebase documentation on managing presence. The link is for Android, but the same functionality is available in the Flutter library.
If you're using Cloud Firestore, such functionality isn't available directly in the product, but you can integrate Realtime Database and Firestore to build a presence system.
Related
Have 2 apps on separate devices: Rider & Driver.
Let's say, the Driver needs to contact the Rider via messaging, or vice versa, is there a way to do it without using the stocked message app to protect privacy?
My idea was to create on both apps an empty box, add a text view for the message and send button and add the msgs to firebase db. Unfortunately, i am not sure how i would do it in Android as well as the response.
Any suggestions or how to's would be greatly appreciated.
You could probably integrate your app with Firebase.
For simple messaging, you could use Firebase Cloud Firestore to do it and for notification, you can use Firebase Cloud Messaging.
Messaging
You can have a sub-collection to store all the chats between the rider and driver in the form of documents. 1 chat will be a document storing the info such as time, sender, as well as message.
Notification
From the doc:
Send acknowledgments, chats, and other messages from devices back to
your server over FCM’s reliable and battery-efficient connection
channel.
You could start research from Firebase sample application.
Highly recommend you go through this third party tutorial: Firebase Tutorial: Real-time Chat to get some idea, it's in iOS but the concept is the same.
Yes, there is a way to do it.
Actually you can use any messaging platform, e.g. Firebase, ConnectyCube, Twillio, Layer etc.
All of them provide API & SDK for iOS, Android and Web for chat so you can easily do it using it.
I used ConnectyCube some time ago, it can be done in the following way:
Initialize app
Sign Up user
Connect to chat
Create a chat dialog with other user
Send/Receive messages
More detailed chat code sample for Android can be found here
Most of the above platforms provide a cloud hosted plan, but some of them also provide an Enterprise plan when you the whole platform can be installed at your AWS/Google/Azure account, so hence the privacy is the best because you own all your data
I am creating an android game where the user should be able to see other users that are currently online when answering questions and should be able to interact with them - ask questions and chat basically. No state will be saved after the user has interacted with other users - that part of the app does not save chat history nor does it save users online. I was looking at ejabberd and open fire or do i go with GCM?
Google Cloud Messaging, now rebranded on it's newer version, Firebase Cloud Messaging -- is a service commonly and mainly used for push notifications. I don't see how you could use this to build a Presence System, so no.
You might want to look into Firebase Realtime Database, specially this Firebase Blog on creating a Presence System with it.
I designed movie program that let user to select specific movies to let him follow any new news about it. For any important article i notify my user using firebase notification but how to make it automation to notify any one of them about any specific movie or category ?
according to my googling i can do that using google app engine but i am not sure !
There are multiple routes to go about what you are looking for. All of them will require you to set up a server, either on app engine or something similar, that continuously updates your database with new information. I would not rely on just data change events on your database in your app to do notifications though. I would look into Firebase Cloud Functions as well as Firebase Cloud Messaging where you wait for something in the database to change with a function, which then pushes the notifications with cloud messaging.
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
We are implementing a mobile app which let users share to-do lists. The idea is to have as little server administration as possible and obviously keep cost down.
For user management and push notifications we will use Parse.com with Cloud Code and PubNub for real time data delivery.
Every user will log in with it facebook' s credentials and subscribe to a read only private channel that only him can read. Every time he create a new to-do list to share with his facebook's friends, the app will make an API call to CloudCode, with it's identity, the data to share and a list of friends. In CloudCode the data is pushed to the PubNub private channels of the list of friends.
In addition in CloudCode the idea is to use PubNub Presence and if the user is offline, send a Push notification.
Is this implementation ok? I'm new to both services and trying to learn. Thanks!
PubNub is appropriate if you are trying to implement a realtime app such as a chat application or a GPS tracking application. But in your case, I think you may not need PubNub's features at all. You can have the afore mentioned functionalities using Parse.com only. The parse push can be used in both the scenarios.
When the user is logged in, and is using the application :- Receive the push, suppress the notification and update the UI with the newly received data.
When the user is not online or logged in, then simply create a notification and add a click listener activity for it.
The reason why I suggest to remove PubNub (for this particular application) is that, PunNub has a different pricing model for loading history. On the free plan, you are limited to one day of message history. On the other hand, you can run this app's backend on Parse.com, almost free cost.
There's nothing in the architecture you describe above that Parse can't handle, including the ability to support Facebook login and external service calls via Cloud Codes Parse.Cloud.httpRequest(). It will do it and do it well thus the answer is yes, this is ok.
Go forth and Parse.