简体   繁体   English

没有收到推送通知到Android设备

[英]Not getting push notifications to the Android device

I'm trying to send push notifications to an Android device using PHP and according to the result I get from Google, it should be working. 我正在尝试使用PHP将推送通知发送到Android设备,根据我从Google获得的结果,它应该可以正常工作。

Result from Google: Google的结果:

stdClass Object
(
    [multicast_id] => 6.72923727292E+18
    [success] => 1
    [failure] => 0
    [canonical_ids] => 0
    [results] => Array
    (
        [0] => stdClass Object
            (
                [message_id] => 0:1380125340880858%35261526f9fd7ecd
            )

    )

)

According to the documentation, if I'm getting a message id back, it should at some point be sent to the device. 根据文档,如果我收到消息ID,则应在某个时候将其发送到设备。 I've previously gotten error messages like "MismatchSenderId" and "InvalidRegistration", but after a few fixes, this is the result I'm getting, and what I would expect to be a successful result. 我以前已经收到了“ MismatchSenderId”和“ InvalidRegistration”之类的错误消息,但是经过一些修复,这是我得到的结果,并且我希望它能取得成功。

"When a 3rd-party server posts a message to GCM and receives a message ID back, it does not mean that the message was already delivered to the device. Rather, it means that it was accepted for delivery." “当第三方服务器将消息发布到GCM并收到消息ID时,这并不意味着该消息已经传递到设备。而是意味着它已被接受传递。”

If this is the result I get from Google (using my API key and sending to http://android.googleapis.com/gcm/send ), am I at least doing the right thing in the PHP? 如果这是我从Google获得的结果(使用我的API密钥并发送到http://android.googleapis.com/gcm/send ),那么我至少在PHP中做正确的事情吗? Or should I expect a different result? 还是我期望得到不同的结果?

If it helps, in order to get this result I'm sending the following information: 如果有帮助,为了获得此结果,我正在发送以下信息:

{"registration_ids":["some_device_token"],"data":{"message":"a simple message","title":"a title","link":"some_url"}}

Any help would be greatly appreciated! 任何帮助将不胜感激!

Your were in correct track in push notification using PHP. 您在使用PHP的推送通知中处于正确的轨道。 There may be a delay in receiving the notification in device and also scrutiny with some other android device. 在设备中接收通知可能会有所延迟,并且还会与其他一些Android设备一起进行审查。

* I am 100% sure your were correct in PHP Coding * * 我100%确定您的PHP编码正确无误*

Please check with Google device token id generated from the device was an accurate because i too face same issue then i rechecked with application 请检查从设备生成的Google设备令牌ID是否正确,因为我也遇到同样的问题,然后重新检查了应用程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM