I'm learning to use PhoneGap. I want to send a notification to all the users of my app
For that I have register into https://console.developers.google.com and created my app.
I have the API_KEY
the PROJECT_NUMBER
which looks like: XXXXXXXXXXXX
I have added to my phonegap app the plugin with
cordova plugin add phonegap-plugin-push --variable SENDER_ID="<PROJECT_NUMBER>"
It seems that the plugin is correctly installed. And I dont know how to go through. I know I can make a curl to send a notification, but how should it be?
Could anyone provide a curl example to send to push notification for Android?
EDIT
I'm sending the notification like this:
curl -X POST \
-H "Authorization: key=<API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"registration_ids": [
"<PROJECT_NUMBER>"
],
"data": {
"message": "Hello Message"
},
"priority": "high"
}' \
https://android.googleapis.com/gcm/send
but I'm receiving a 401 Unauthorized Error. What's wrong?