This question already has answers here:
How to send Device to device notification by using FCM without using XMPP or any other script.?
(3 answers)
Closed 5 years ago.
I have seen that most of the android tutorial are sending a push notificaiton using an website system to control how to send to the devices. Is there a method to send from an android device to another android device and the device can automatically compose the message to the other devices without extra setting?? Thank you.
Sure create a custom server, send the token and message to server, the token must identify the user device that will compose the message. When the message is received on the composer end, send another token and message to the server, this time along with a field(composer) thus identifying and agreeing that this token will compose a message. use appropriate mechanisms to handle such a request. Make sense? so basically it's just sending multiple but from different and each device creates special field identifying the intent of the message.
Related
This question already has answers here:
How to send one to one message using Firebase Messaging
(5 answers)
Closed 3 years ago.
I want to send message from one mobile to another mobile(Push Notification).
Firebase has a push notification service, but it's not directly between mobile to mobile.
It's either mobile to desktop(Upstream), or desktop to mobile(downstream).
Basically the app is supposed to send alert from one mobile to another.
I am beginner, would really appreciate if there's already a function for this.
It is not possible at least not in Sweden because the mobile operators are doing som funky routings with the ip address. Because of this it is only possible to create an outgoing connection from a mobile phone. Even if you have the mobile ip address you cant lock on and get an in going connection.
This is why there are services like Firebase, Signal and others that offer the flexibility to solve this problem
Of course some operators offers static ip adress for an extra fee, that would make it possible to run anything incoming, but users in general does not subscriber to this since they have no use for it
Look forward to if someone can prove me wrong..
I have done this with the help of a web configuration.
You will need a Web database table to save the FCM Token and username for each device.
Username can be any unique thing you can get from any registration process you want or you can hard code that as well for testing purpose but FCM Token Id must be auto Generated you can find the code how to get it form web.
Every Device FCM Token ID is attached with the username and must be unique which will be used to distinguish between all the devices in web.
Now the Process will be--
sender mobile -> Server Having all the FCM token id (and code to send notification) -> Receiver Mobile
From sender device you call the server, sending it the message and the receiver's username.
Now at server side it will search its table and find the particular FCM Token id for the specific username you have sent.
Now it will send the given message to the device of that specific token Id.
Hope this will help you!
This question already has answers here:
How do you send a Firebase Notification to all devices via CURL?
(10 answers)
Closed 3 years ago.
I would like to send data messages to all users.
Is it possible to do it programmatically, without using the Firebase Notifications Console?
The problem with the Console is that the "message text" field at the beginning of the form is compulsory. So, even if I add the custom data key/values, there will also be the standard notification component.
As stated here, when the message includes both notification and data, in case the app is in the background, a standard notification message will be notified to the system tray.
I would like instead to deliver only a notification based on the custom data (trigged by OnMessageReceived).
How can I achieve that? Programmatically, I can correctly send data messages to specific users, but I cannot find a way to send data messages to ALL users.
Use topic messaging. You can define the name of a topic that all installations of your app will subscribe to, then send the message to that topic.
You can use the Firebase Admin SDK from your server to send that message. Or you can use the FCM HTTP API to send that message.
I am been using Parse for sending push notifications earlier and that does not seem to work well. I heard from the internet that we can send push notifications from one android device to another using GCM and I followed this official documentation. Before I get to implement it, I just need to know whether, we can send push notification from an Android device to another using this service.
I have the following doubts
How do I send the push notification to a specific device using another device with the help of GCM ?
What is the unique identifier that I must be using if the above question is possible ?
Should I implement my own backend to save the unique identifiers about which the above question states ? Or is there a way that GCM can handle for me ?
The answers to all your questions are in the documentation itself.
1) Send Upstream message from Device A to the server and send Downstream message from server to Device B.
2) Instance ID API will provide a token which is the unique identifier.
3) Yes you have to implement you server that will communicate with GCM connection server.
All of which is explained on the overview page itself.
I hope this answers your question. There is also a sample you can refer to.
Also, a tutorial here.
Just wanted to check if it is possible to send push notification from one andriod app to a different andriod app considering both the apps has different product id and browser keys. If its not possible then what is the work around other than picking up the message from SMS inbox and displaying it ? The purpose is to have a merchant facing app and a different consumer facing app for intraction. So if a merchant push messages it should come as notification in the consumer app.
Yes, it is possible. You need to obtain registration ID from the application you want to send the push message to and to know the API key. Just like when you want to send push messages from a server.
However, if there is a server involved, it is better to use the server to send the messages instead. It won't need to deal with unstable network connection.
This question already has answers here:
How to make a chat application in android? [closed]
(6 answers)
Closed 9 years ago.
I am developing an Android app in which I have to implement chat messaging. I would like one to one chat or a group chat.
But I have no idea how to start. Please help me with this stuff. Any help will be appreciated.
A simple chat mechanism will have 2 basic functionalities
Send the message to server (with info about the recipient)
Receive the message from server (designated for my user name)
First step is simple, we can create a web service which will accept the message with additional information about recipient(s). We can create it using any server side language.
Step 2, that is fetching the message from server can be done using 2 techniques, Pull the message (using polling) from server, or Push the message from server to android phone
Polling: In this, the android device will keep accessing server after a few seconds to check if there is a message available for user. This again can be implemented using a simple async task at the client side which will keep calling a web service after say 2-3 seconds. This is fine to use if we are planning to enable chatting only when user is accessing the app (no notifications like gmail or facebook), so that we can kill the polling service when not in use (otherwise it will eat up resources).
Push notifications: a better option is to use push notifications. Android provide Google cloud messaging or GCM (http://developer.android.com/google/gcm/index.html) which will help achieve push from server easily. Otherwise you can try a third party API like urbanairship or pushwoosh depending on your requirement. Push notifications will help the user to receive messages even when he is not using the app.
So in nutshell, a webservice to receive the messages and a push notification mechanism should be sufficient to implement a chat service in android.
Little bit about UrbanAirship
I used UA in one of my projects for push notifications as I needed to support both iOS and Android. If you just want to support Android GCM might also be a good option.
Coming back to UA, check this for sample code and usage: https://docs.urbanairship.com/display/DOCS/Home
The way it works is simple, when someone installs the app and is connected to internet, app registers itself to the UA service. A unique code is specified for each installed app (this is the time when you can capture the user name and unique code and store somewhere in your DB). Next UA provides an API using which you can push a message to designated recipient(s), using the unique codes which are available with UA. These messages can be received by android app and used as per the requirement. Even if the app is not running we can show a notification just like when we receive an email or a message
You can use an existing platform like Scringo. It gives you a one-on-one chat as well as group chat (both the client and the server) as well as the push notification service.