设备到设备的推送通知系统

发布于 2024-11-05 18:10:01 字数 198 浏览 2 评论 0原文

嗯,我的想法是制作一个安装在两个或更多设备上的应用程序。主要或“头部”设备可以以推送通知的形式向特定设备之一发出呼叫。推送通知可以是预设的或者其他什么。目标是建立一个简单的通知系统。我为其制作此内容的所有用户都拥有一台处于活动状态的 iPad,并且坐在他们面前的桌子上。将其想象为一种医生工具,用于在患者准备好时将护士叫到房间。告诉我这是否足够清楚。

这将如何完成?

Well, my idea is to make an app that is installed on two or more devices. The main or "head" device can send out a call to one of the specific devices in the form of a push notification. The push notification could be preset or whatever. The goal would to be a simple notification system. All of the users who I am making this for have an iPad active and sitting on a desk in front of them. Imagine this as a doctor tool for calling the nurse into the room when the patient is ready. Tell me if this is clear enough.

How would this be done?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

热鲨 2024-11-12 18:10:01

如果我正确理解你的问题,你想开发一个可以将通知推送到其他设备的应用程序。

最好的方法是拥有一个服务器并让设备发送通知以向服务器发送请求。然后服务器会将其存储在数据库中。然后,当其他设备向服务器发送请求以检查是否有新内容时,它们会看到最新的条目并向手机推送通知。

参考 Dave DeLong 的评论,如果人们不想使用分钟/文本/3G/4G,而只想使用 WiFi,那么这个应用程序实际上可能会很好。对于小公司来说也比使用对讲机有好处。 (最后一部分可能有些牵强。)

祝开发顺利!


为了使设备检查来自服务器的新通知,只需让它在设定的时间间隔内访问一个链接(可能每 5-10 秒一次;理想的情况是让用户设置更改检查之间的时间间隔) ):

hxxp://domain.com/checkForNew.php?deviceID=foo&otherSecurity=blah

然后让 PHP 返回一些您可能需要的值。示例输出如下:

fromID|toIDs|发送日期|消息

在 iPhone 上,您可以使用以下方式获取此内容:(

NSString *googleString = @"hxxp://domain.com/checkForNew.php?deviceID=foo&otherSecurity=blah";
NSURL *googleURL = [NSURL URLWithString:googleString];
NSError *error;
NSString *googlePage = [NSString stringWithContentsOfURL:googleURL 
                                                encoding:NSASCIIStringEncoding
                                                   error:&error];

此代码可以在此处找到:从 UIWebView 读取 HTML 内容

最后,将此字符串分离到适当的变量中并推送通知。

If I understand your question correctly, you want to develop an app that can push notifications to other devices.

The best way to would be to have a server and have the device sending the notification to send a request to the server. The server would then store it in a database. Then when the other devices send a request to the server to check for anything new, they would see that newest entry and push a notification to the phone.

In reference to Dave DeLong's comment, this app might actually be good if people don't want to use their minutes/texts/3G/4G, but instead only want to use WiFi. Also would be good for a small corporation instead of having walki-talkis. (That last part may be a stretch.)

Good luck on developing!


In order to make the device check for new notifications from the server simply have it access a link during a set interval (maybe like every 5-10 seconds; an ideal situation would be to have a setting for users to change the time interval between checks):

hxxp://domain.com/checkForNew.php?deviceID=foo&otherSecurity=blah

Then have the PHP return some kinds of values that you may need. An example output would be:

fromID|toIDs|dateSent|message

On the iPhone you can get this content using:

NSString *googleString = @"hxxp://domain.com/checkForNew.php?deviceID=foo&otherSecurity=blah";
NSURL *googleURL = [NSURL URLWithString:googleString];
NSError *error;
NSString *googlePage = [NSString stringWithContentsOfURL:googleURL 
                                                encoding:NSASCIIStringEncoding
                                                   error:&error];

(This code can be found here: Reading HTML content from a UIWebView )

Finally, separate this string into appropriate variables and push the notification.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文