如何在特定时间发送FCM通知?

时间:2016-10-03 06:55:49

标签: python firebase-cloud-messaging pyfcm

我可以立即通过PyFCM向单个或多个设备发送FCM通知。

# Send to single device.
from pyfcm import FCMNotification

push_service = FCMNotification(api_key="<api-key>")

# OR initialize with proxies

proxy_dict = {
          "http"  : "http://127.0.0.1",
          "https" : "http://127.0.0.1",
        }
push_service = FCMNotification(api_key="<api-key>", proxy_dict=proxy_dict)

# Your api-key can be gotten from:  https://console.firebase.google.com/project/<project-name>/settings/cloudmessaging

registration_id = "<device registration_id>"
message_title = "Uber update"
message_body = "Hi john, your customized news for today is ready"
result = push_service.notify_single_device(registration_id=registration_id, message_title=message_title, message_body=message_body)
print result

但我找不到在特定时间向设备发送通知的方法,比如03-10-2016 16:00:00

1 个答案:

答案 0 :(得分:0)

如果您正在为预定的推送或有效负载参数寻找FCM的公共API,您可以设置推送日期,遗憾的是,目前还没有类似的内容。

您必须自己实施自己的App Server并实施预定推送(也称为here)。

我在标记的重复帖子中的回答。