How to send a push notification via GCM to an iOS device?

I need to catch up with a notification from GCM. I do not receive notifications when my application is in the background. But I see them when he is in the foreground.

for the GCM test functions, I use it:

curl -X POST -H "Authorization: key= KKKKKKKKKKKK" -H "Content-Type:    application/json" -d '{"to":"XXXXXXXXX","data":{"message": "It is special push notification for test!!!"}}' https://gcm-http.googleapis.com/gcm/send

I see this message (if the application is active). but when i use it:

curl -X POST -H "Authorization: key= KKKKKKKKKKK" -H "Content-Type: application/json" -d '{"to":"XXXXXXXX","data":{"message": "It is special push notification for test!!!"},"notification":{"body":"great match!","title":"Portugal vs. Denmark","icon":"myicon"}}' https://gcm-http.googleapis.com/gcm/send

In this case, I do not see the message.

Do you know how to send notifications via GCM that will be displayed when the application is turned off?

PS It seems that GCM does not work with APN.

+4
source share
1 answer

You need to send priority parameter as high to notify ios devices.

Description for proirity:

. "" "." iOS APN 5 10.

. . , .

, , .

, .

library Java, Apple-, , .

+1

Source: https://habr.com/ru/post/1605702/


All Articles