简体   繁体   中英

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.

Result from 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. 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.

"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."

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? 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. There may be a delay in receiving the notification in device and also scrutiny with some other android device.

* I am 100% sure your were correct in PHP Coding *

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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