如何触发应用程序通过REST服务获取数据? [英] How to trigger an app to fetch data via a REST-Service?

查看:82
本文介绍了如何触发应用程序通过REST服务获取数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种触发应用程序以从远程REST服务获取数据的方法.该方法不需要轮询.

I am looking for a way to trigger an app to fetch data from a remote REST-Service. The approach shouldn't require polling.

iOS推送通知似乎不是一个选项,因为它可以被用户停用.但是,我可能错了.

iOS push notifications doesn't seem to be an option due to the fact that it can be deactivated by the user. However, I may be wrong.

是否有最佳实践来做到这一点?

Is there a best practice to get this done?

推荐答案

实际上,推送通知是一种解决方法.

Actually Push Notification is the way to go.

在ios8及更高版本上,正是出于此原因,默认情况下启用了推送通知. 您无法向用户显示任何内容(意味着将不会显示包含带有警报的json的推送),但是您的应用正在获取有效负载,并且在收到推送后便可以启动操作.

On ios8 and later, push notifications are enabled by default for exactly this reason you want. You cannot show something to the user (meaning pushes containing a json with an alert will not be shown), but your app is getting the payload and can initiate an action once the push is received.

来自文档:

用户的通知设置仅控制系统是否 在屏幕上显示本地或远程通知. 无论 通知设置,将本地和远程通知传递到 您的应用在适当的时间.

A user’s notification settings control only whether the system displays local or remote notifications onscreen. Regardless of the notification settings, local and remote notifications are delivered to your app at the appropriate times.

这篇关于如何触发应用程序通过REST服务获取数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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