Tag: firebase notifications

如何确认实际发送了firebase通知(fcm)?

我允许用户通过我的网站发送通知。 通知正在运行,但是,我想要一种方法来实际确认通知是否已发出(在代码中),或者如果不可能至少确认curl有效,那么我可以在我的网站上显示一条消息它要么成功要么失败了。 在我的jquery post请求中,状态似乎总是“成功”,即使我在我的php中提供了无效的API_ACCESS_KEY(因此它显然没有发送通知但它仍然说成功)。 我如何确定通知已发出? 感谢任何帮助。 这是我在index.html中的post请求: $(“#send-button”).click(function(){ if($(“#send”).val().length == 0) { return; } else { $.post(“php/send-notification.php”, { notification_message: $(“#send”).val() }, function(data, status) { alert(“Data: ” + data + “\nStatus: ” + status); // status seems to always be “success” even with an invalid API_ACCESS_KEY }); } }); 这是send-notification.php: $_POST[‘notification_message’], ‘vibrate’ => 1, ‘sound’ => […]