2015-09-03 59 views
1

Gcm在前景和背景發送到apn時發送。 < - 發送ok當iOS應用程序被殺時,Gcm未發送到apn

但是,如果強制退出應用程序,gcm不發送給apn。 < - 發送不好

當強制退出應用程序時,可以發送通知,因爲「APN測試器」是發送通知可用。

<測試條件>

iPhone 4

7.1.2

對象C代碼(GcmExample.app)

使用捲曲

< curl --header "Authorization: key=$server_api_key" \ 
--header Content-Type:"application/json" \ 
https://android.googleapis.com/gcm/send \ 
-d "{\"data\":{\"title\":\"title\"},\"notification\":{\"body\":\"noti test\",\"content_available\":true},\"to\":\"$token\"}" > 

<等使用>

"GcmServerDemo"工具

"APN Tester"工具

+0

如果你的應用程序從應用程序切換器終止,那麼你的應用程序將不會得到推送通知。你可以看到[這個StackOverflow的答案](http://stackoverflow.com/a/26141776/4195406) – ztan

+0

根據測試結果,我嘗試了一個強制關閉應用程序後,「APN測試器」可以發出通知。 –

回答

3

你應該嘗試有high APNS priority例如消息

curl --header "Authorization: key=$server_api_key" \ 
     --header Content-Type:"application/json" \ 
     https://android.googleapis.com/gcm/send \ 
     -d "{ 
     'data': { 'title': 'title' }, \ 
     'notification': {'body': 'notitest' }, \ 
     'content_available': true, \ 
     'to': '$token', \ 
     'priority': 10, 
     }" 

您需要設置priority明確地10其他GCM假定正常APNS優先級,可以得到高延遲。

Here is the GCM reference在這裏你可以閱讀關於priority字段。

+0

改變優先的作品,謝謝 –

相關問題