问题描述
我新的轨道,并希望让我的Android应用工作,在我的rails app.What是最好的策略创建的数据自动生成/自动更新一个JSON或XML饲料与我的rails所创建的数据与我的Android应用程序中使用的应用程序?
I am new to rails and wish to make my Android app work with data created in my rails app.What is the best strategy to auto-generate/auto-update a JSON or an XML feed with the data created by my rails app to be used with my android app?
推荐答案
JSON是要走的路。
作出具体的控制器和行动,以便提供您的Android应用需要消耗数据,并使用类似Rabl的或JBuilder的宝石来创建所需的数据结构JSON模板。您将需要使用JSON库Android版
JSON is the way to go.Make specific controllers and actions to provide the data that your Android app needs to consume, and use something like the RABL or jbuilder gem to create json templates with the data structure that you want. You will need to use the Json libraries for android
一些进一步的阅读你,因为它不可能提供更详细的解答这样一个普遍的问题。
Some further reading for you as it's impossible to provide a more detailed answer to such a general question
和如何从发布的Android JSON一个不错的简单的教程
and a nice simple tutorial on how to post json from Android
的
和如何使用JSON
您应该找到观看的所有视频的时间,但它的最后一半是非常重要的。
然后处理无论你怎么称呼它你的Rails API / REST接口或版本
Rails和Android或iPhone为此事作出真棒组合。
You should find the time to watch all of that video but it's the last half that is really important.Then to handle versioning of your Rails API/REST interface or whatever you want to call ithttp://railscasts.com/episodes/350-rest-api-versioningRails and Android or iPhone for that matter make an awesome combination.
以上应该足以让你开始,至少让你的地步,你可以问更具体的问题,但一旦你得到你的头一轮的基础知识,你真的需要使用同步适配器来处理流量。 Android开发团队真的强烈建议您采取同步适配器方法,因为可以在这个很长的GOOGL我可以看到/ O视频
The above should be enough to get you started at least to get you to the point where you can ask more specific questions, but once you get your head round the basics you really need to use a sync adapter to handle the traffic. The Android development team really URGE you to take the sync adapter approach as can be seen in this very long googl I/O video
这篇关于使得Android应用程序获取从轨道表中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!