使用Django和FCM推送通知

时间:2020-01-02 07:38:12

标签: python django push-notification

遇到问题,发送消息表明一切正常,但接收方未收到通知。

from push_notifications.gcm import send_message

# target is the user and device_id is the token received from the mobile
send_message(
        target.device_id,
        {'Message': [f'User {request.user} send a friend request']},
        'FCM',
    )
# response
{'multicast_id': 8075165042107727***, 'success': 1, 'failure': 0, 'canonical_ids': 0, 'results': [{'message_id': '0:1577698440016169%6afcf2daf9f***'}]}

响应成功,但手机未收到消息

但是如果我发送批量通知,接收者会收到他们的消息

       for ids in device_ids:
           send_bulk_message(ids.device_id, {'message':
                                       f'You where invited to {instance.name}'}, 'FCM')

有什么主意吗?

0 个答案:

没有答案