I wanted to send Asynchronous messaging with Parse,
When i push a notification,client devices may not be online but i wish them receive all notifications after being online.
but when i pushed 2 notification client just received 1 notification(The last one).
Is there any queue semantic with Android Parse push notification?
Related
I am creating mobile application using latest version of Ionic 3. And I am at the point where I need to implement push notifications. I am using FCM. I have managed to done it for Android phones using this plugin: https://github.com/phonegap/phonegap-plugin-push. Reading documentation for this plugin, it says that for Android I should send only Data Messages and that that is the best practice. It also says that send Notification and Data payload would not work properly:
When your app is in the foreground any on('notification') handlers you have registered will be called. If your app is in the background, the notification will show up in the system tray. Clicking on the notification in the system tray will start the app and your on('notification') handler will not be called as messages that have notification payloads will not cause the plugins onMessageReceived method to be called.
But for IOS I need to send notification message with data payload. This would not be a problem if I target directly devices, however I need to send Topic Messages. So the way I see is that on my server I need to implement this logic:
Let's say that the name of topic is FOOD-AND-DRINKS:
function onSomeEvent($data) {
// send push notification to topic ANDROID~FOOD-AND-DRIKS
// send push notification to topic IOS~FOOD-AND-DRINKS
}
Also, since in the future my plan will include multiple cities, and not all people would like to listen for notifications for cities other the one where that person lives, so then my topic would be PLATFORM~CITY~CATEGORY.
So my question would be, is there any better plugin for handling notifications, or some service between my server and Google FCM and that service would take care of that, or this is quite OK what I have proposed?
You can use cloud functions to be able to send notifications since you are using FCM also.
More on this here: https://firebase.google.com/docs/functions/
Cloud Functions for Firebase 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. There's no need to manage and scale your own servers.
Using cloud functions you can use database triggers like onWrite() and it will be able to send notifications if you have data payload and/or notification.
But if you use data payload alone then you can send if android device is in background also.
Regarding Topics:
If you have multiple cities in your application, then you can let the user register to each topic. You can do in the database like this:
city-category
id_here
cityname: nameX
//other details
id_here1
cityname: nameY
//other details
I am trying to send push notification to both android and ios. On Android push notification is handled by data while on ios notification is required in payload to display the notification.
But if notification part is added and if user is subscribed to the channel on both the device. On Android it show 2 messages created by notification part of payload.
Any particular way to send the payload from firebase. So that it can run on both the devices.
Thanks in advance
Like Frank said, Firebase does support sending messages to both iOS and Android.
If you send a notification message with a data payload (so both notification and data) the Android client will either display the auto generated notification based on the notification payload if the app is in the background or be passed to the onMessageReceived callback where you have the option to generate a notification based on the data and/or notification payloads if you wish if the app is in the foreground. There will not be two notifications generated.
I am trying to migrate to Firebase cloud messaging from GCM and I noticed that when the application is not running the notifications are coming in the notifications tray. With GCM this was not the case, it was up to the developer to show a notification or not. I want to have similar behavior with FCM where when the app is running I want to silently handle the push message instead of having user to click on the notification and start the app. How can I achieve that.
Thanks,
P
Firebase Cloud Messages has two types of messages:
Notification Message: this type of message has the same behavior as the GCM messages
FCM automatically displays the message to end-user devices on behalf of the client app. Notification messages have a predefined set of user-visible keys
Data Message: this type has the behavior you described above.
Client app is responsible for processing data messages.
Data messages have only custom key-value pairs.
To send data messages you need to use the HTTP API [for Data Message]. (quoted from Arthur)
Full documentation: https://firebase.google.com/docs/cloud-messaging/concept-options
I am using Amazon SNS for push message in my android app. I want to send push messages from one android app/device to another and I am not able to find any documentation for this. Is there a way I can send upstream message to the server from a device/app which will be delivered to another device.
I'm wondering if it is possible to receive a http data e.g. http inputstream without sending http request. Because right now, I can receive data online through HttpURLConnection.getInputStream() when sending http request. My question, does it always have to send a request in order to receive a response or any kind of data like input stream or is there a way to regularly receive data? How about the facebook mobile? how does the phone receive data for example facebook notifications while I'm not doing anything?
You're looking for the Google Cloud Messaging (GCM) Service. Or a push service to push down notifications. You push to their services, and they'll take care of messaging the phones, which wake up your app to handle the notification. You can then choose what to do with that notification, like show it in the notification bar or run some code to update the app in the background.
GCM
Amazon SNS