如何从网站服务器发送数据到Android应用 [英] how to send data from website server to android app

查看:203
本文介绍了如何从网站服务器发送数据到Android应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个项目的要求来配置使用.NET网站android应用的一个主题。
,我有选择,是实施从Android应用程序服务器轮询服务轮询经常看哪个,如果需要任何改变。
任何一个可以点任何更好的方式或方法从网站的数据发送到Android应用程序,而不是应用程序轮询的网站服务器经常

I had a requirement in a project to configure a theme for android application using a .NET website. The options that i have is to implement a polling service from android app to server which polls frequently to see if any change is required. Can any one point any better way or method to send data from a website to android app rather than the app polling the website server frequently

推荐答案

一个更好,但更复杂的方式来做到这一点是使用的谷歌云消息(又名推送通知)。

A better but more complex way to do it is to use Google Cloud Messaging (aka Push Notifications).

这样,你的服务器可以通知应用程序有新的数据进行检索,然后才是你的应用程序必须查询您的服务器。

This way your server can notify the app that there are new data to be retrieved, and only then your app has to query your server.

这是一个更加省电的方法和作品pretty好。我以前用过这个出于同样的原因。

This is a much more battery friendly approach and works pretty well. I've used this before for the same reason.

要回答一些太的意见,投票是一个坏主意,因为

To answer some of the comments too, polling is a bad idea because


  • 这两个过度使用你的服务器和用户的设备没有理由

  • 它会消耗用户的电池

  • 总是会有当服务器要与应用程序和时间您的应用程序会做下一个轮询通信之间的一些延迟。

的推送通知的方法需要更多的努力,但具有很大的优势了。

The push notification approach takes more effort but has great advantages too.

这篇关于如何从网站服务器发送数据到Android应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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