小编and*_*s25的帖子

Google Firebase通知在控制台上运行,但不在API上运行

从firebase控制台发送通知时工作正常,但从API发送时不起作用.即使结果显示成功:{"multicast_id":5946406103096345260,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1480093752122166%13791f60f9fd7ecd" }]}

无论如何继承代码:

<?php
// Payload data you want to send to Android device(s)
// (it will be accessible via intent extras)    
$data = array('title' => 'Notification Title' ,'message' => 'Hello World!');

// The recipient registration tokens for this notification  
$ids = array('TOKEN');

// Send push notification via Google Cloud Messaging
sendPushNotification($data, $ids);

function sendPushNotification($data, $ids)
{
    // Insert real GCM API key from the Google APIs Console        
    $apiKey = 'API_KEY';

    // Set POST request body
    $post = array(
                    'registration_ids' …
Run Code Online (Sandbox Code Playgroud)

php push-notification ios firebase google-play-services

6
推荐指数
1
解决办法
1604
查看次数