WP7 - 如何与网络服务同步?
我正在开发一个多平台“偶尔连接”的应用程序。应用程序的每个实例都存储从云检索的数据的“缓存”,云具有权威的数据存储。因此,在启动时,应用程序将检查其缓存是否已过期,如果是,则从云端下载增量。这在 WP7 中当然是可行的。我不知道如何实现是将应用程序所做的任何更改发送回云端。当用户退出应用程序时,在 iOS 或 Android 中,我会启动一个后台任务将增量传输回云端,但是使用 wp7,如果没有后台功能,我将不得不在关闭时传输,并且我无法保证传输将在操作系统杀死我的应用程序之前完成。难道这在今天的 WP7 上无法实现吗?
I'm working on a multi-platform "occassionally connected" app. Each instance of the app stores a "cache" of the data that it retrieves from the cloud, which has the authoritative datastore. So on start-up the app would check if its cache is out of date, and if so download the delta from the cloud. This is certainly do-able in WP7. What I don't know how to achieve is to send any changes made by the app back to the cloud. When the user exits the app, in iOS or Android, I would launch a background task to transmit the delta back to the cloud, but with wp7, without that background functionality, I would have to transmit on close, and I could not guarantee that the transmission would finish before the OS killed my app. Is this just not achievable on WP7 today?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里有几个选项,您可以单独应用,也可以同时应用。
您可以与服务器进行更聊天的对话。即,在用户接受更改时传达更改。
您还可以在应用程序运行时运行一个后台进程,定期发送更改。
有时可能会出现更改未发送并且应用程序不再运行的情况。这些将在应用程序下次运行时被拾取。
我想你可以将其描述为尽力而为的基础。
A couple of options here which you could apply independently or both of.
You could do a more chatty conversation with your server.. ie communicate changes as they are accepted by the user.
You could also have a background process runing while your app is running that sends changes up at periodic intervals.
There may be times when the changes aren't sent up and the app is no longer running. These would be picked up next time the app is running.
I suppose you could describe this as a best effort basis.