Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have an android application with firebase and i want to send a notification to a specific client from another client .
"cloud messaging" allows me to send a notification to every client has the application.
Firebase Cloud Messaging also allows you to send a notification to a single client, as long as you know the FCM token of that client. For example see the section on sending a message to a token using the Composer in the Firebase console, and sending a message to an individual device using the Admin SDK, and sending a message to an individual device using the HTTP REST API.
But FCM does not allow directly sending notification from once client to another. You will always needs to send the downstream messages from a trusted environment, such as the Composer in the Firebase console, your development machine, a server you control, or Cloud Functions.For more on this, see:
How to send one to one message using Firebase Messaging
How to send device to device messages using Firebase Cloud Messaging?
Diego's answer here
probably many more of these search results
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I am completely new to the whole concept of push notifications. I have written a back-end server and I will send push notifications from it to the Android app, which is also written by me. But my question is:
Do I really need, or why would I need a Push notification service?
Thanks!
If you want to use FCM to send push notifications, at some point in time, someone has to make a request to Google's FCM service, because Google is the only one, who can send a message to a device via FCM. Same applies for APNS, at some point in time, someone has to make a request to Apple's APNS service
Depending on your requirements, you can do this yourself in your own code or you can use some 3rd party provider. Using a 3rd party provider MAY have benefits. For instance they may take care of token management, or provide a single request for sending to Android and iOS devices, and so on and so forth. But in the end of the day, also a 3rd party provider sends out requests to Google or Apple in your behalf.
You can use firebase cloud messaging service or using socket programming for this .
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
From my research MQTT brokers only save the most recent message but facebook uses MQTT in its messenger app. So are they using a custom broker to retain the messages?
https://www.facebook.com/notes/facebook-engineering/building-facebook-messenger/10150259350998920
My question is it possible for mqtt brokers to retain all messages sent so that I can create my own chat messaging mobile application? I know that paid services like HiveMQ offer this functionality but I am looking for a free alternative.
MQTT is a protocol for sending and receiving messages between a client and server. What either does with the messages beyond the basic requirements of the protocol will be implementation dependant.
You could use a application subscribed to a topic to store all messages in a database - it does not have to be a function of the broker component.
The usual MQTT broker works in a passive manner. It gets the message from publishers and forwards it to any available subscriber.
I think Facebook uses another process that receives the messages and then sends it to the clients again. The clients then can send another MQTT message when it receives the message.
However, MQTT has some QoS mechanism. It's possible to use it if there's a persistent connection to the client. Facebook may be making use of that too.
In case you need message persistence out of the box, it's not possible with MQTT though. You can use a technology such as Apache Kafka.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to send a push notification when an event happens in my app, without using the Firebase console for this.
Can I send a request by json to the server? And if so, how? Because I have difficulties in this part.
Thank you
You can send upstream messages from your app to Firebase Cloud Messaging. But you will need your own app server to respond to those messages. I recommend reading the documentation on the role of these servers.
Since you cannot send direct device-to-device messages with Firebase Cloud Messaging, an alternative for some developers is to use the Firebase Database for keeping a queue of the messages. You'll still need an app server to read that queue and send the downstream messages to the devices, but at least you won't have to learn XMPP.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Please suggest way to build watsapp like chat application.
In My Android application i have to put Chat Functionality
I already knows following ways.
Chat application by using GCM (Google Cloud Messaging).
Socket Programing
By using our webservice
Is there any other techniques for chatting app?
There are various methods to develop chat application.
1) Using HTTP connection (In this method each and everytime you want to send message, you have to call the webservice and for receive message, you continously need to call the webservice using Timer).
2) Using XMPP Server (XMPP server uses Socket programming, so once a connection will be establish, then it uses that connection each and everytime, you no need to create connection everytime, like HTTP).
3) Using GCM (Using Push Notification you can send and receive messages as well).
Things you need to build a chat app:
Server:
This is required to store all the user information like username, password and gcm registration id (will come to this later).
You can host it anywhere Amazon EC2, Google App Engine, etc
APIs for login, chat message sending, message list, delete message and many others.
Registration for GCM push notification:
Refer the link below:
https://www.digitalocean.com/community/tutorials/how-to-create-a-server-to-send-push-notifications-with-gcm-to-android-devices-using-python
Android:
Register to GCM and send the gcm registration id(as mentioned in point 1) to the server for updating.
Design user interface to send message, sending a message can be done either through REST API or by using socket connection.
You can explore XMPP and MQTT.
Server to Device communication and vice versa:
Now, on receiving message coming from the device, publish the message to the socket connection and as a fallback send push notification to the receiver device. There are 2 ways to do it:
i) Send the message payload along with the push notification
ii) Only send "sync" and on receiving the "sync" notification, receiver's android app can make a call to the server, fetch all the messages and show it to the user. Benefit of this approach is that the messages will never be lost. You will have to maintain the "sync" timing on the android app side.
Above was the normal way to build it if you want to learn but if you want to just get it done fast then you can integrate Applozic Mobile & Web Chat Libraries which will get you started with chat within half an hour. And the beauty is you wouldn't even need to develop or host any server.
Sample code to build chat in available in Github:
Android Chat SDK https://github.com/AppLozic/Applozic-Android-SDK
Web Chat Plugin https://github.com/AppLozic/Applozic-Web-Plugin
iOS Chat SDK https://github.com/AppLozic/Applozic-iOS-SDK
PS: I am the Cofounder #Applozic
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am new to GCM and have a few questions regarding an app implementation. The app should be capable of upstream messaging. So -
Do I have to create a server (lets say in Google App engine) which will communicate with GCM. And then GCM will send the message to the app. Or I can do it just with CCS connection and my device can send message to app on another device without a server?
Is there a code example of writing server side code which I can use in App Engine? I badly need some tutorial/code implementation on CCS to understand the logic. I dont think android developer site is enough to understand things clearly.
Help appreciated!!
Hi Actually I am using http://parse.com to create server and push notification in android.
First of all you should always go to the source and read, as Google provides samples and everything.
About 1 and 2 then it depends if your going to use a third party provider or do everything yourself.
If your making everything yourself then YES you need a server and YES Google provides some code but I've never used it so I can't tell you how much work you have to put in it.
If you just want GCM capabilities but it doesn't have to be Googles, then there is plenty of alternatives out there: Parse.com and Urban Airship to name at least two.
Following link will help to code GCM but it is unidirectional(from third party server to cloud only)
http://avilyne.com/?p=267
Google GCM CSS provides upstream messaging that is from application(http://developer.android.com/google/gcm/client.html), you can send a message. This message will reach the Google server and they will send you the same message to your server, which you have to implement(https://developer.android.com/google/gcm/ccs.html).Do what you want with it.
If you have to send a message from your server to the client(application), you can send it via your css server or by making a http call to the google gcm http server. They will send the message to the client. You have to handle the received message and can show as a notification or use internally.