I'm using django-push-notifications to send push to our ios users (using APNS).
from push_notifications.models import APNSDevice, APNSDeviceQuerySet
from apps.notifications.db.models import Notification
from apps.users.db.models import User
class APNSService:
def __init__(self, user: User, title: str, body: str, data: dict):
self.user = user
self.title = title
self.body = body
self.data = data
def get_devices(self) -> APNSDeviceQuerySet:
return APNSDevice.objects.filter(user=self.user)
def send_message(self):
return self.get_devices().send_message(
message=dict(
title=self.title,
body=self.body
),
badge=Notification.objects.filter(recipient=self.user, unread=True).count(),
extra=self.data
)
The problem is, that notifications comes without a sound. According to the docs, there should be extra field to execute the sound when notification is received.
How to do this?
There is param
sound
, example