我正在构建一个 django 应用程序,我想知道在满足特定条件的情况下,在 React Native 应用程序中向用户发送推送通知的最佳方法是什么。这个想法是向用户组发送通知。甚至可以同时有 100 个用户
答案 0 :(得分:1)
嗯,我一个小时前就做了。试试这个:
pip install pyfcm
OR
pip install git+git://github.com/olucurious/PyFCM.git
示例:
# Send to single device.
from pyfcm import FCMNotification
push_service = FCMNotification(api_key="<api-key>")
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)
# Send to multiple devices by passing a list of ids.
registration_ids = ["<device registration_id 1>", "<device registration_id 2>", ...]
message_title = "Uber update"
message_body = "Hope you're having fun this weekend, don't forget to check today's news"
result = push_service.notify_multiple_devices(registration_ids=registration_ids, message_title=message_title, message_body=message_body)
print result
你只需要使用firebase。从他们和你的 device_registration_id 或 device_token 获取 api 密钥,你就完成了。
有关更多信息,您可以关注以下link
答案 1 :(得分:0)