Send Push Notifications to specific users- Cordova - android

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/

Related

Is it possible to send push notification through APNS to device token generated via FCM?

In the project , I am generating device token for both IOS and Android using FCM. And push notifications . In my research, I found push notifications can be sent with https://fcm.googleapis.com/fcm/send
But is it possible to send push notification to IOS device, By using APNS api.sandbox.push.apple.com to the token generated with FCM ?
Apple docs Link
No. Api.sandbox.push.apple.com can only be used with Tokens generated by Apple. You need to fetch the Apple token in the client using didRegisterForRemoteNotificationsWithDeviceToken and send it to your server.
BTW, the Firebase SDK does exactly that and fetches this token in order to send iOS notifications. For each FireBase token they fetch the relevant Apple token from the device and use it when connecting to the Apple servers.

FCM - Sending android push notifications by device tokens and environment/group

I would like to implement a method in which android push notifications through FCM are sent by both specific device tokens and an environment/group.
Just like there are two environments which needed to be implemented for sending iOS push notifications through APNS (sandbox & production), I would like to do the same using FCM.
Any suggestions?
Thanks in advance.
For setup FCM push notification just goto Firebase Console then add project and setup other settings for environments. Then goto cloud messaging tab and you will fine "server key" and "sender id". You need to share this with server side developer. From server side need to handle push notification for specific device tokens and an environment/group.

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!

How to merge IOS push notification in Android push notification use web service

I am using push notification in android push notification like GCM and i want to add IOS push notification in GCM.
Admin will set text in text box and than notification will be sent to both device like android and IOS devices.
Thanks
You can use gcm for android & apns for IOS seperately or use 3rd lib such as https://parse.com/tutorials/android-push-notifications.
In 1st solution, when phone connects to your web server. Web server must recognize client is android or ios. And later when web server wants to send message to client it will send push notification to GCM or APNS.

Why push notification server send message to client exactly

Example with Facebook application in iOS, use Apple Push Notification Service (APNS). I think when Facebook server see an new feed or new friend request, it will send a message to APNS. After that, APNS will push notification to client, who is logging in that facebook account. My question is :
Why APNS know which device logging in that facebook account ?
How APNS can send message to that client exactly (why APNS know client's IP address) ?
As I know, Push Notification also a technology use in Windows Phone ( Microsoft Push Notification Service), and Android (Cloud to Device Message).
Thanks.
Well APNS (Apple Push notification Service) works on a per device per app unique ID.
You push you message to this unique ID and it get deliver on the users device.
Your app must request this ID and pass it to the server wich will send out the notifications.
The ID is that create by the APNS API, thus Apple knows that the ID belongs to that device and app.
I guess that the windows and android will work in the same way.

Categories

Resources