Chat implementation using firebase - ios

I have implemented chat application using firebase realtime database and it working fine. I have few more requirements to meet the complete functionality. Below is the requirement
Last entered message with date/time
No. of Unread message
While you are in the chat listing page showing or updating the counter with messages spontaneously when someone is sending you message
Sending push notification when a user send message
Is these possible using the firebase functionalities ?

Related

Send currency in push notifications via Firebase Cloud messaging

We are able to send currency via the Custom data parameters in Firebase Cloud messaging (see SS below).
But if the user does not tap the notification "YOU RECEIVED 15 FREE GOLD!" then Firebase.Messaging.FirebaseMessaging.MessageReceived is never fired and the user never gets their currency. So the user may see the notification, and then be disappointed the next time they open the app and there is no gold.
Is there a way in Firebase to compose the notification so that the notification can be accessed even if the user did not tap the notification to open the app?
Without tapping on notification your application not launch and custom data you sent through notification is not received to the application. So sending custom data through firebase push notification is wrong choice in this scenario. You should sent custom data whatever you need through API is always good choice. You can also use firebase database and in that you can send custom data using nodes for respective user.

Implementing push notification in a chat app

I am building a chat feature using firebase Realtime database where an integer variable stores a number (int online) which when a chat is opened by person A it adds 1 to the database and then if another person B comes online and opens the chat then it adds another 1. So, if the number is 2 I know that both are online and active in the chat app so no need to send push notification.
But the issue that I am facing now is that if a user closes the app without pressing the in-built back button of the chat app (which when pressed subtracts 1 and becomes 0 when both users are inactive), then the number in the database is not changed which causes error in the push notification logic as when Person A sends a message, the code assumes Person B is online. How could this be solved? Please someone help me understand how push notifications generally work?
First off all sending push notifications is completely FREE. The only costs are made by the the backend (cloud functions) that executes the code to send them.
Secondly. If your users are in the app no push notifications will be shown. Even if you would like to show some in your app you would need to handle the onMessageReceived to show something to the user while he is in the app.
That means there is no need for you to do the thing you try to do. Just send all messages as if no user is in the app. It would even cost you more to check for each user if he is online or not and send the messages only if he is offline than just to send them to everyone.
I would recommend to read the docs a little bit to get a deeper understanding of FCM and if you have any specific questions we can all help you with it :)

chat app Firebase Recieving messages

Currently I have an IOS chat app that runs with firebase. The app is working fine and sending and receiving messages when two users are online. I am using real-time database, however when one of the user is offline (i.e application is killed or even the app is running in background) and the other user is sending a message the messages are not received. Is there is a way where can I know the current state of the user and instead of sending the message I send a notification to notify him that there is a new message.

How to send custom notification in iOS using Firebase Notifications.

I am working on an iOS app in Swift and Firebase as Realtime DB.
Its an app that sends motivational quotes to users via Firebase Push Notifications. Currently, I am using Firebase Compose message to send notifications.
Using firebase is there a way in which Users can specify what time of the day they want to be notified?
e.g. Daily once - 12PM; Daily twice - 12PM, 8PM.
I am using Cloud Functions to get the user details required for sending notifications and triggered them with cronjob.

Using Firebase to send and receive push notification for an iOS app

I am create a firebase based chat application for iOS. One of the features is to send push notification to the users in the same chat room (if they are offline).
I can't find a firebase function (for iOS) that can be used to send push notifications to the user.
Is it possible?
Displaying alert badges and notifications on iPhone applications is accomplished through Apple's Push Notification system. Since the application is not running on the user's phone when they receive notifications, the APN will have to be triggered from your server-side code.
You'll probably want to create a server-side module that listens for changes to your chat Firebase. When a message appears for a user that is offline, you'll have to schedule a remote notification with the APN. That latter part has nothing to do with Firebase, but has extensive documentation on Apple's developer web site.
I'm not sure if a web application can display alerts or badges. Otherwise this approach will only work if you create a native wrapper for your Firebase chat application.

Resources