Skip to content

Commit

Permalink
Add silent notification example for GCMDevice (#698)
Browse files Browse the repository at this point in the history
Co-authored-by: Jamaal Scarlett <[email protected]>
  • Loading branch information
ishakoktn and jamaalscarlett authored Feb 23, 2024
1 parent 31c88d7 commit 307a1b8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ FCM/GCM and APNS services have slightly different semantics. The app tries to of
# but for more complex nested collections the extras dict will be sent via
# the bulk message api.
device.send_message(None, extra={"foo": "bar"})
# You may also pass a Firebase message object.
device.send_message(None, extra={"foo": "bar"}, use_fcm_notifications=False) # Silent message with custom data.
# You may also pass a Firebase message object.
device.send_message(messaging.Message(
notification=messaging.Notification(
title='Hello World',
Expand All @@ -160,7 +162,6 @@ FCM/GCM and APNS services have slightly different semantics. The app tries to of
))
# If you want to use gcm.send_message directly, you will have to use messaging.Message.
device = APNSDevice.objects.get(registration_id=apns_token)
device.send_message("You've got mail") # Alert message may only be sent as text.
device.send_message(None, badge=5) # No alerts but with badge.
Expand Down

0 comments on commit 307a1b8

Please sign in to comment.