How to send silent push to iOS via Google Cloud Messaging

前端 未结 3 2005
清酒与你
清酒与你 2021-01-04 07:05

How to send silent push notification to iOS application over GCM?

Silent push is notification that will not appear in notification center, but awake application to d

3条回答
  •  难免孤独
    2021-01-04 07:36

    I'm using the node-gcm npm library and the following payload works for me for iOS (for Android I'm sending a slightly different payload):

    { dryRun: false,
      data: 
       { customKey1: 'CustomValue1',
         customKey2: 'CustomValue2',
         content_available: '1',
         priority: 'high' },
      notification: 
       { title: 'My Title',
         icon: 'ic_launcher',
         body: 'My Body',
         sound: 'default',
         badge: '2' } }
    

    Of course you'll need to ensure that your app can handle the inbound notification.

提交回复
热议问题