aws push notifications for multiple devices - java

I am using aws sns for sending push notifications to devices(mobile devices mostly android). I am able to send notifications to individual devices but i want to publish a common message that has to be sent to all the active devices. I have created platform application and created the end points using all the device registration ids and also created the topic and subscribed to it but when i publish the message, the publish is success and i get the message id but i am not getting the notifications. I have implemented most of the methods which are in AmazonSNSClient class. If someone can guide me it would be very helpful.

Check the aws console in the website using your credentials there you will find details of the notifications sent. If you find that the notification is sent then probably the notification has failed. AWS does not guarantee the delivery of notifications.

Related

How to query message send record in Firebase Cloud Message? [duplicate]

I have an iOS app that integrated with Firebase Cloud Messaging to send push notifications from. I know that Firebase saves history of all sent notifications.
Is there a way for each specific device running the app to fetch its own history of sent notifications? I need to do it on client side, not on server.
There is currently no API to retrieve details of all the sent notifications with FCM (see this and this).
The idea is still feasible, however, you'll have to store the logs/history on your own, in your App Server. From there, you could setup your app to retrieve the details that only correspond to the device.

AWS SNS response handling

Am new to implement AWS SNS SMS gateway for my Java program. After the successful publishing message to AWS, I would like to know is the message send or not? Its always giving a response with messageId even the message fails to send. Is there any specific method or API to expose for this?
From the SNS FAQ:
Q: How do I track the delivery status of my SMS messages?
By enabling the Delivery Status feature in Amazon SNS, you can get information on the following for each message: MessageID, Time Sent, Destination Phone Number, Disposition, Disposition Reason (if applicable), Price, and Dwell Time.
In other words from the docs:
Amazon Simple Notification Service (Amazon SNS) provides support to log the delivery status of push notification messages. After you configure application attributes, log entries will be sent to CloudWatch Logs for messages sent from Amazon SNS to mobile endpoints. Logging message delivery status helps provide better operational insight, such as the following:
* Know whether a push notification message was delivered from Amazon SNS to the push notification service.
* Identify the response sent from the push notification service to Amazon SNS.
* Determine the message dwell time (the time between the publish timestamp and just before handing off to a push notification service).
Reference, check for code examples:
https://docs.aws.amazon.com/sns/latest/dg/sns-msg-status.html
So it seems you're up to using cloudwatch for this. The messageid you get from the API will of course be useful to filter for the information.
I suggest that you open a ticket for AWS support (because of your further questions as comments):
For professional support I suggest to open a case with them: https://console.aws.amazon.com/support/home#/case/create?issueType=service-limit-increase&limitType=service-code-sns-text-messaging

Send Push Notifications to my app users

I've added the GCM services to my applications with help from this guide.
But now I want to create a new app, which I'll send the Push Notifications from. This app will be my Push Notifications sender.
My target is to send Push Notifications to all of the users of my applications.
How would I accomplish that?
Do I have to use the Device Group Message or something else?
Is there any good tutorial of how to do this? I have no idea how to make it.
GCM implements CCS which is XMPP endpoint to provide upstream messaging. You should have your own server to handle users and direct messages. Actually you need both downstream and upstream which is basically called chat.
Take a look at the links for detailed instructions:
Cloud Messaging / Send Upstream Messages
GCM-XMPP Chat Tutorial

Send data to android app from web client

I'm trying to make it such that a click on my web client from a computer can "trigger" the android app to run its set function.
I've searched extensively but it seems like all methods need the mobile device to initiate a connection before the web server can even do anything.
Is there a way for the web client to be the one initiating? Also, is there any way to do this without notifying the user of the device, i.e. in the background? I'm using cakephp for the web client but any kind of answer will be appreciated. Thanks!
Use push notification system to trigger any action on your device. Push notification system such as Parse, PushApps, pubnup etc are available for free and some are paid too. Try them. Send a push notification and listen to that push message and on receiving trigger your action.
Use Google Cloud Messaging .
"Google Cloud Messaging for Android (GCM) is a service that allows you to send data from your server to your users' Android-powered device, and also to receive messages from devices on the same connection. The GCM service handles all aspects of queueing of messages and delivery to the target Android application running on the target device. GCM is completely free no matter how big your messaging needs are, and there are no quotas."[Google]
Here you'll find how to implement the GCM with PHP.

How does GCM locate a user phone

My question is how does the Google Cloud Messaging know where to send the message to? does it work by IP Address? Is there an interval that runs a function on the phone to send the current location or IP Address of the phone to the Google server? Does anyone know?
Google doesn't need to know the IP address of your device. Instead, your device connects to Google, identifies itself using whatever protocol Google uses for authentication, and Google then uses that established connection to send notifications to your device.
When your phone changes from one IP address to another, it simply makes a new connection to Google, and Google then uses that new connection for your notifications. Google wouldn't even need to keep track of your IP address after you disconnect, since as soon as you disconnect (like on a public wifi system), somebody else might start using that same address.
Here is the link which explains the working of GCM http://developer.android.com/guide/google/gcm/gcm.html
Every GCM client creates a unique device token that you need to send to GCM server for sending the push notifications to client.
Here you can find link explaining the GCM.
GCM Works by Running a Service of its Own to handle Push Notifications.
This service requests the Google Cloud Server (GCM) with your app token ID created by GCM for any pending notifications created by your app and sends the response back with all the notifications from your token id to your app, and this happens for the all the apps using GCM.
So, basically if you have 5 apps which have implemented GCM then their token IDs will be send together by this service and GCM will check if any notification is available for the sent token id's and send them as a response.
Read this thread, this guy has explained it, and GCM is reliable for new app builds !!
http://eladnava.com/google-cloud-messaging-extremely-unreliable/

Categories