我们可以在不使用 APN 的情况下推送通知吗?
是否可以将通知从我的第 3 方服务器直接推送到我在内联网 (Wi-Fi) 中的设备?我已经在 APN 的帮助下实现了向设备推送通知,但我要求在不使用任何外部服务的情况下实现相同的目标,比如说我的服务器和我的设备连接到 Intranet,我需要检测设备的可用性内网直接发送通知。有什么想法吗?提前致谢
Is it possible to push notification from my 3rd party server directly to my device in Intranet(Wi-Fi)? I have achieved to push notification to the device with the help of APNs, but my requirement to achieve the same without using any external service, say my server and my device is connected to an Intranet, i need to detect the availability of the device in the Intranet and send notification directly. Any idea?? Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,如果(听起来如此)您正在开发一款不必通过 App Store 的企业应用程序,那么没有什么可以阻止您使用 iOS 4 多任务 API 来模仿 APNS 的工作方式。基本上,您的方法是将您的应用程序注册为通过
UIBackgroundModes
Info.plist 键提供 VoIP 服务,以便系统自动启动它并使其在后台运行,然后让该应用程序打开与您的服务器的持久 IP 连接,通过该连接您可以向其发送您喜欢的任何通知数据包。从那里,应用程序当然可以使用 UILocalNotification 来提醒用户通知。请注意,如果您必须通过 App Store,则大部分内容都是无效的,除非您的应用程序实际上要提供 VoIP 服务。但既然您提到使用 Intranet,我假设您将在内部开发一些东西,并且是 企业开发者计划,它可以让你跳过整个App Store的事情并自由地使用SDK。
Well, if—as it sounds—you’re developing an enterprise app that doesn’t have to go through the App Store, there’s nothing to stop you using the iOS 4 multitasking APIs to mimic the way APNS works. Basically how you’d approach it is to register your app as providing VoIP services via the
UIBackgroundModes
Info.plist key—so the system launches it automatically and keeps it running in the background—and then have the app open a persistent IP connection to your server, via which you can send it whatever notification packets you like. From there, the app can of course useUILocalNotification
to alert the user of the notification.Note that most of this is void if you do have to go through the App Store, unless your app is actually going to provide VoIP services. But since you mention using an intranet, I assume you’ll be developing something in-house and are a member of the enterprise developer program, which allows you to skip the whole App Store thing and use the SDK freely.