Message response with success but the receiver din't get the notification
Hi, get a issue, sending message shows that every thing went well but the receiver din't get the 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': 8075165042107727806, 'success': 1, 'failure': 0, 'canonical_ids': 0, 'results': [{'message_id': '0:1577698440016169%6afcf2daf9fd7ecd'}]}
response with success but mobile din't get the message
but if I send a bulk notification receivers get's their messages
for ids in device_ids:
send_bulk_message(ids.device_id, {'message':
f'You where invited to {instance.name}'}, 'FCM')
Any idea?
send_bulk_message and send_message it same function, check your data and i see you use device_id, but for send message need using registration id
Yes I know that send_bulk_message and send_message is same function, using just for readability and other understand that I want to send to multiple users.
But what do you mean by registration_id ? If you mean a unique string from a user (mobile phone) that is the device_id or you mean something else. Could you provide a link to documentation or explain. That would be helpful, thanks @ivlevdenis
@FuManQ from send_message doc:
Sends a FCM (or GCM) notification to one or more registration_ids.
The registration_ids can be a list or a single string.
This will send the notification as json data.
registration_id it's id received on registering device on Firebase.
From Firebase doc https://firebase.google.com/docs/cloud-messaging/android/first-message#retrieve-the-current-registration-token.