Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add silent notification example for GCMDevice #698

Merged
merged 2 commits into from
Feb 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading