Android GCM server side messaging - android

So I got the reg_id and can send notifications to my device. However the notifications are all with a default "Push notification message" vs the actual message.
The payload data I am sending is {'message':'this is a test'}.
In iOS APNS I would have done the same but the key being 'alert'.
Am I doing something wrong?

Related

Working principles of Android Push Notification System (how does push notification works in Android?)

I have two questions related to Android Push Notification System:
What is the working principle of this system? The client sends its own IP to the Google Cloud Messaging Service (for example when it switches its own IP)? So it a sort of pooling?.
How do you know that Google Cloud Messaging Service "looks into" the content of the notification message (created in the server and dispatched to the client)?
Answering the question about how GCM service contacts the client, the GCM client contacts GCM to create the connection. You are correct that device addresses change as the device disconnects and reconnects so GCM cannot initiate the connection from the server side.
This connection is maintained as much as possible and is not created for specific messages.
The registration id identifies the device and app and allows GCM to route the message to the device, if it is connected. If it is not connected, GCM needs to wait until the device reconnects.
What is the working principle of this system? The client sends its own
IP to the Google Cloud Messaging Service (for example when it switches
its own IP)? So it a sort of pooling?
I'm adding an image here describing how GCM works.
This is a step by step presentation. You need to get the push registration ID first when your application launches. So if you've a backend server to send some push notification in your application, you need to pass the registration ID to your backend server. So when you need to send a push notification, your backend server will send the push directly to GCM with the targeted registration ID. GCM manages to push the notification in your device when your device comes online.
So this is not any kind of pooling. The only thing GCM needs to know is the registration ID of your device when it comes online and tries to communicate with GCM. Once your device is registered, GCM sends the push notification using that registration ID.
How do you know that Google Cloud Messaging Service "looks into" the
content of the notification message (created in the server and
dispatched to the client)?
This question is not very clear to me. As far as I have understood, you wanted to know how GCM understands to whom it needs to send the push notification when the notification is coming from your backend server. If this is your question, then I think I have answered it already in the previous section of my answer.
GCM doesn't need to look into your notification content to know the destination of the push notification. As I said earlier, when your application launches, it requests for a push registration ID from GCM and when it receives an registration ID, you might have to pass the registration ID by calling a service of your backend server. The server then knows to whom it might send some notification.
So, when its time to send a notification to your client application, the backend server sends the notification to GCM with the registration ID you sent to your backend server earlier. GCM then handles sending the push notification to the client when the application comes online.
Hope that helps!

Send push notification from one android app to another using Amazon SNS

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.

Parse :: Sender is not allowed to send messages. Android Push Notifications

I have a problem sending push notifications in Andoid using Parse. I have a project in iOS and I recive all push notifications perfectly. But in Android, when I want to send a Push Notification using parse platform I recive the following message:
Sender is not allowed to send messages.
Any tips?
Best Regards!

Send Push Notification to the server

I've implemented GCM Push Notification in the server and in my android device .
Im able to send push notification from the server and receive it in my device.
Now im trying to send push notification from my device to the server.
Is it possible?
I heard about upstream messages but didnt found anything about it.
Thanks.

Send Push Notifications to specific users- Cordova

Is there any way through which one can send push notifications to specific user/device? This both question gives me enough understanding to send push notification to android devices:
PhoneGap Build Push Notification (Android)
Push notification in Android and Phonegap
If I want to send notifications to specific users in Cordova, how can I send?
For this purpose your will need:
A server that can authenticate your users and store their push notification IDs.
A cordova plugin that will accept push notifications sent from your server and pass it on to your application.
For the cordova plugin, I'd suggest PushPlugin
Assuming you have a server where your user credentials are stored, add structure and an API to store user's push notification IDs and methods to send notifications to selected users. All this will depend on what platform you choose for your server.
in your server Send a message using GCM HTTP connection server protocol:
https://gcm-http.googleapis.com/gcm/send
Content-Type:application/json
Authorization:key=<API KEY>
{
"to": "GCM ID",
"data": {
"message": "This is a GCM Topic Message!",
}
}
If you change the GCM id with the specific users GCM id you can send the push notification to the specific user for more details please go through the following link
http://phonegaptut.com/2016/05/31/how-to-send-push-notifications-in-phonegap-application/

Categories

Resources