【问题标题】:fcm not arrive the data to samsung devicefcm 没有将数据到达三星设备
【发布时间】:2018-12-24 07:22:18
【问题描述】:

我在 android 中测试 FCM,但在三星设备中没有收到通知。

我发给测试的php代码。

问题:删除字段通知时 未将通知发送到设备三星未发送数据

希望你能帮助我

<?php
  Replace with the real server API key from Google APIs
     $apiKey = "xxxxxxx";

  Replace with the real client registration IDs
  $registrationIDs = array( "xxxxx")

 $fields = array(
      'priority' => 'high',

      'registration_ids' => $registrationIDs,

this line => 'notification' => array("priority"=>'high',
                        "content_available" => true,
                        "mutable_content" => true,
                        'priority'=>'high',
                        "title" => $message, 
                        "body" => $nickname ." Posteo una Inspección", 
                        "sound"=>"default",
                        "click_action"=> "OPEN_ACTIVITY_CHAT"),

              'data' => array(
                "title" => $message, 
                "body" => $nickname ." posteo una Inspección",
                "type" => "0",
                "content-available"=> "1","icon" > "ic_launcher"),
                );
  $headers = array(
      'Authorization: key=' . $apiKey,
      'Content-Type: application/json'
  );

?>

【问题讨论】:

    标签: php android firebase firebase-cloud-messaging


    【解决方案1】:

    您确定 Android 客户端代码正确吗?
    您是否尝试过从 Firebase 控制台向自己发送消息?
    https://console.firebase.google.com/

    您使用的Server Key 是否正确?

    它应该是在您的项目的 Firebase 控制台中找到的那个
    在左上角,您应该会看到Project Overview,单击它旁边的齿轮图标。
    现在点击Project Settings
    然后点击Cloud Messaging 标签。

    您是否使用了正确的注册 ID?
    您是否正在获取您的设备生成的注册 ID,然后在 PHP 中使用它?

    这可能不是 PHP 代码的问题,可能只是设置它的所有小细节。
    我们将尝试先弄清楚这一点,然后再深入研究 PHP。

    【讨论】:

    • 通知在摩托罗拉设备上完美运行,但在三星设备上却不行
    • 当没有现场通知发送时,摩托罗拉会收到通知
    • @Dverdugo 哦,好吧。
    • 但是当删除字段通知时,三星设备没有到达带有数据信息的通知
    • 因为我用回复显示通知!我需要改变风格
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-11-24
    • 2021-05-17
    • 1970-01-01
    • 1970-01-01
    • 2016-10-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多