从 Python 代码发送 Apple 的推送通知
我想从 Python 代码(Django 应用程序)向客户的手机发送推送通知。
我找到了几个实现,其中之一在这里: http://leepa.github.com/django -iphone-push/
我的问题是 - 如何识别我要向其发送通知的设备?我应该使用手机的 UDID 吗?我担心的是它在 iOS5 中已经被弃用,所以我想知道如何将用户与我的 Django 服务器中的手机绑定?
I want to send a push-notification from the Python code (Django app) to client's phones.
I found several implementations, one of them is here: http://leepa.github.com/django-iphone-push/
My question is - how to identify the device for which I'm sending the notification to? Should I use the UDID of the phone? My concern is that it's already deprecated in iOS5, so I'm wondering how to tie the user with the phone in my Django server?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Apple 只允许您向安装了 iOS 应用程序且用户允许您的应用程序向其设备发送通知的设备发送通知。您可以在 此开发者文档。
如果您没有 iOS 应用程序,但仍想向用户发送通知,可以考虑使用 Prowl、Notifio或棚车。这些应用程序允许您使用其 API 将通知传递到用户设备。对于大多数这些服务,它们都有可用的 Python 包。
Apple only let's you send notification to devices on which your iOS applicaiton is installed and for which the user has allowed your app to deliver notifications to their device. You can find more information on how Apple handles (push) notifications in this developer document.
If you don't have an iOS applications but still want to deliver notifications to users, you can consider to use Prowl, Notifio or Boxcar. These apps allow you to user their API to deliver the notifications to a users device. For most of these services their are Python packges available.
来自文档:
使用的令牌是通过在 application:didFinishLaunchingWithOptions: 中注册远程通知来获取的。
如果注册成功,您的应用程序委托将收到 application:didRegisterForRemoteNotificationsWithDeviceToken:
这是您用于发送的令牌推送通知。
PS:django-iphone-push 上次提交是 3 年前。你可以尝试我的分支 django-ios-push。
From the docs:
Token used is acquired by registering for remote notifications in application:didFinishLaunchingWithOptions:
If registering was successful, your app delegate will receive application:didRegisterForRemoteNotificationsWithDeviceToken:
This is the token you use to send push notifications.
P.S.: django-iphone-push last commit was 3 years ago. You can try my fork called django-ios-push.