douyun8674 2015-07-03 19:11
浏览 45

没有收到来自GCM CCS的delivery_receipt_notification

I'm trying to get a receipt from CCS, but I'm just not able to.

Here is what I'm doing:

I have a go script:

package main

import (
    "fmt"
    "github.com/brunohenrique/go-gcm/ccs"
)

var (
    user = struct {
        gcmToken string
    }{"mg0xe56LfjE:APA91bFHtHVQt85iNgyzTeDowovIGPAD_NbBjURppy1LgV9_oaM2R_9zn1fDXNuEeOoALTj7F8e8JmNPI3Md-CbbgTxdvxVrONFVfGz2dOujsaGkZjEhJcBH8sWvRNYZNIp2j2QliAEX"}
)


func main() {
    con := connect()


    // Sends a message
    con.Send(&ccs.OutMsg{
        To: user.gcmToken,
        ID: "m-1366082849205",
        Notification: map[string]interface{}{
            "title": "Hey!",
            "body": "There",
            "sound": "default",
        },
        TimeToLive: 600,
        DeliveryReceiptRequested: true,
        DelayWhileIdle: true,
    })


    // Listen to messages
    for {
        m, err := con.Receive()

        if err != nil {
            fmt.Printf(">>> Err: %+v 
", err)
        }

        go func(m *ccs.InMsg) {
            fmt.Printf(">>> InMsg: %+v 
", m)
        }(m)
    }
}

Everything seems alright when I run the script, but no receipt message back:

enter image description here

And this is what I'm doing when I get the notification:

enter image description here

Am I doing something wrong or missing something?

  • 写回答

2条回答 默认 最新

  • dpyln64620 2015-07-07 19:20
    关注

    Not sure if you're trying this on Android or iOS, since it works for me on Android but it doesn't always work on iOS.

    Delivery receipts for iOS do not work with the notification parameter in the request. I was able to get it to work for a plain data message i.e. with payload

    {
      "to" : <reg id>,
      "data" : {
        "hello" : "world",
        "id" : 123
      }
    }
    

    But if I added the notification payload to the above one it didn't work.

    I would assume that since a notification payload message needs to be sent via APNS there is no way for them to know whether the message was delivered or not since APNS does not return any result.

    For a no notification message since it's received only when the app is in the foreground they would be able to verify if the message was delivered or not.

    评论

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀