Closed usgitAz closed 8 months ago
hello @usgitAz, the APIs is pretty much consistent. You only have to
swap out the GCMDevice
interface for Apple's APNs
.
for example, to send a message to an APNs device, you would do:
from push_notifications.models import APNSDevice
device = APNSDevice.objects.get(registration_id="your_device_token")
device.send_message("Hello world!")
and in your case, to attach a ttl to the message, you would do:
device.send_message("Hello world!", extra={"apns": {"apns-expiration": 0}})
The extra
parameter is a dictionary that gets passed to the underlying
push service. In the case of APNs, the apns
key is used to pass
additional parameters to the APNs service. The apns-expiration
key is
used to set the time-to-live for the message.
Hope that helps!
Thank you for your help
hi i send push notification for my android users with time_to_live with this code:
user_devices = GCMDevice.objects.filter(user__id=user_info["user_id"], active=True) for user_device in user_devices: user_device.send_message( message=message, title=title, time_to_live=43200, image=user_info["profileimage"] ) now i want send push notif for ios users with title , message , image and time_to_live this same as android ?