使用推送通知时如何处理多个设备? [英] how to handle multiple devices when using Push Notification?

查看:66
本文介绍了使用推送通知时如何处理多个设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个要在其中使用推送通知服务的应用程序.我有一个服务器,现在我想知道

I am developing an application in which I want to use push notification service. I have a server, now I want to know that

  • 如何处理多个设备?

  • How do I handle multiple devices?

每个iphone都有唯一的设备ID/名称吗?

Is there a unique device id/name for every iphone?

假设我要删除对特定设备令牌的请求,那么如何处理多个用户?

Suppose I want to delete request for a specific device token, so how do I handle multiple users?

是否可以通过应用程序为每个设备生成唯一的名称?

Is there a way I can generate unique name for every device through application?

推荐答案

您应该真正阅读APNS

You should really read the APNS documentation, this is all explained in depth there.

简短的答案是,当您在手机上启动应用程序时,它会从操作系统请求推送通知键.然后,您获取该密钥并将其发送回您的服务器.您的服务器通过Apple的服务器发送推送消息时会使用该密钥,以指示要将推送消息发送到的设备.

The short answer is that when you launch an app on the phone it requests a push notification key from the OS. You then take that key and send it back to your server. Your server uses that key when it sends a push via Apple's servers to indicate the devices to send the push out to.

该服务仅向您提供令牌.如果您想要帐户或设备名称,则需要提供它们或将其与凭据一起存储在服务器上.

The service just gives you a token. If you want accounts or device names you need to come up with them and store them with the credentials on your server.

您使用与处理单个用户相同的方式来处理多个用户,然后使用适当的密钥向服务发送消息.

You handle multiple users by same way you handle single users, you send message with the appropriate key to the service.

关于删除请求,不能这样做.这就像一条短信,在击中设备之前可能会有一些延迟,但是在您进行推送的那一刻它可能会立即传递.

As for deleting a request, you can't. It is like a text message, there may be some latency before hits the device, but the moment you commit the push it could be delivered instantly.

这篇关于使用推送通知时如何处理多个设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆