[英]Checking xml version generated by ruby on rails with an android app
I have an android app that feeds on an xml file that is generated in my server with Ruby on Rails. 我有一个Android应用程序,该应用程序使用Ruby on Rails在服务器中生成的xml文件。 I want to download the new version of the xml file only when the it is newer than the one I have previously downloaded.
我只想在xml文件的新版本比我以前下载的版本新时下载它。
I would like to know what is the best way to do this in both sides: generate the version of the xml somehow somewhere in the server and obtain the version of the file using android. 我想知道在两边都这样做的最佳方法是什么:以某种方式在服务器中的某个位置生成xml的版本,并使用android获取文件的版本。
Right now I am downloading an xml with the last day of modification of the xml I want to download an in that way compare it with the one I have locally, but I don't think this way is very efficient. 现在,我正在下载xml修改的最后一天,我想以这种方式下载xml,并将其与本地本地的xml进行比较,但是我认为这种方式并不十分有效。 Can you suggest any other way to do it?
您能建议其他方法吗?
Thanks in advance 提前致谢
instead of pre-generating the XML file and then downloading it you can generate it upon HTTP GET request, from the Android app you can pass a parameter in the URL that represents a version or the last update time. 您可以在HTTP GET请求中生成XML文件,而不是预先生成XML文件然后下载它,而是从Android应用程序中传递一个代表版本或最后更新时间的URL参数。
then your server can check by this parameter if a new version should be generated. 那么您的服务器可以通过此参数检查是否应生成新版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.