Python 如何将静默通知从服务器发送到ios设备?
这是我的python脚本,它将fcm通知发送到设备 它发送优先级通知而不是静默通知。。。。 我怎样才能让他们安静下来Python 如何将静默通知从服务器发送到ios设备?,python,ios,django,apple-push-notifications,firebase-cloud-messaging,Python,Ios,Django,Apple Push Notifications,Firebase Cloud Messaging,这是我的python脚本,它将fcm通知发送到设备 它发送优先级通知而不是静默通知。。。。 我怎样才能让他们安静下来 def sendGCMToTopiciOS(): url = 'https://fcm.googleapis.com/fcm/send' headers = { 'UserAgent': "GCM-Server", 'Content-Type': 'application/json', 'Authorization
def sendGCMToTopiciOS():
url = 'https://fcm.googleapis.com/fcm/send'
headers = {
'UserAgent': "GCM-Server",
'Content-Type': 'application/json',
'Authorization': 'key=' + 'XXXXXXXXXXXXXXXXXXXX',
}
data = {'title': 'Yugam', 'message': 'Hello Everyone', 'event': '13', 'workshop': '-1',
'link': 'https://www.google.com'}
notification = {
'body': data.get('message'),
'title': data.get('title')
}
values = {
'to': '/topics/' + 'global',
'data': data,
'notification': notification,
"aps":{
"content-available":1}
}
pipe = requests.post(url=url, json=values, headers=headers)
return pipe.json()
要发送数据消息,您需要跳过json有效负载的
通知
部分“通知”字段将导致iOS 10向系统发送通知,并根据给定值自动显示通知。如果您正在寻找完全无提示的通知,请尝试:
values = {
'to': '/topics/' + 'global',
'content_available': true
'priority': 'high',
'data': data
}
这将在后台交付,无需发出警报。“content\u available”(内容可用)字段也将转换为“content available”(内容可用):1在通过APN的GCM服务器后。您能添加更多信息说明它为什么不工作吗?你能在应用程序处于打开状态但处于后台时尝试吗?