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 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
http://railscasts.com/episodes/322-rabl
http://railscasts.com/episodes/320-jbuilder
and a nice simple tutorial on how to post json from Android
http://localtone.blogspot.co.uk/2009/07/post-json-using-android-and-httpclient.html
and how to consume json
http://hmkcode.com/android-parsing-json-data/
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 it
http://railscasts.com/episodes/350-rest-api-versioning
Rails and Android or iPhone for that matter make an awesome combination.
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
http://www.youtube.com/watch?v=xHXn3Kg2IQE
Related
let me ask my question with an example:
Assume that I have some PHP files for my android app that I put it on 000webhost[dot]com; so, my question is how can I use parse (parseplatform[dot]org) in this situation?
I'm new in backend, so I'm sorry if this question is stupid!
For some reason I can't use back4app, aws, etc.
Don't worry about php language, if it's necessary I can write it in another language. (my backend logic is not complex)
If you need a simple web-site with simple backend logic, I'd do that using Express.js. Since Parse Server is essentially an Express.js middleware, you can use the same process to serve both Parse Server and the web-site.
If you prefer to use a different technology, Parse Platform provides many different sdks (https://parseplatform.org/#sdks) that you can use for many different backend technologies (including PHP), or you can connect directly to the REST (https://docs.parseplatform.org/rest/guide/) or GraphQL (https://docs.parseplatform.org/graphql/guide/) apis using any client.
When I asked this question, I didn’t know what exactly should I search until I found this amazing article. This article opened my mind, the most helpful thing that I found there, was this:
Parse is more flexible. Given the freedom to host Parse on the
server of your choice.
You can choose the self-hosting option and deploy your Parse project
on your selected server, such as Digital Ocean.
And then I found this awesome video on youtube.
Now I can run parse on my own server (vps or cloud).
I know the title of this question may not be clear, but I don’t want to change it, because someone like me doesn’t know the right keyword for research.
Hope this help someone else too.
I've come across this problem when thinking about creating different apps for Android. I see these apps that show you the weather cast or sport results, and I wonder which is the source they get all data from.
I assume they don't have their own database which they fill with data manually and live. I suppose they use some kind of web service, data source or something like that. I don't know if web service is the correct term to use in this case (english is not even my native language).
So I would like to know the correct term for what I'm looking for, plus any guidance on finding this kind of services, in order to be able to develop apps using this kind of data sources.
I think this question will help many programming students like me.
It depends what you trying to develope- Some apps use simple GET/POST Requests and get it's data back formatted as JSON or XML (which is the common case).
Some uses SOAP for getting their data.
In some cases they are using plain Sockets or CouchDB.
In some cases they are using Push Mechanism (specially for android) like GCM to send their data to the client.
It always depends what you want to do.
I am currently a student of Android.
My aim is to develop Android Apps that talk with different websites and exchange/process/return data.
But I am really not sure what should be starting point.
Coming from a backend development I can put the layout for backend development as follows
a) Understand Relational DB concepts
b) SQL
c) PLSQL
d) Procedures/Functions
e) Solve realworld problems
....etc
Similarly can someone tell me what should be starting point for learning Android integration.
HTTP or Web Services or REST API or JSON/XML or anything else
All these terms are new to me and when I googled/wikied the terms I can (kinda) grasp what they mean but I am not able to see the big picture as to how they fit etc...wrt integrating an app with a website.
TLDR.what should be the starting point for learning Android Integration ?.
PS : If this is a wrong forum, then do let me know which forum to post this on. Thanks !!!
Your question is so general, and there is no clear answer for it, and you are not ready to build a real app unless you can answer it by your own, so you need to know more about each term of the above, then your question will be "what is the best practice?"
You can start from below:
IBM: Using XML and JSON with Android
XML vs JSON Based Web Services: Which is the Best Choice?
XML vs JSON parsing in Android
JSON or XML in Android
By the way many developers prefere JSON, because JSON is simpler than XML/SOAP and has less overhead, and payload will be smaller than the XML representation, beside Android has JSON parseing APIs.
I don't know whether I should ask this question here. I have very little experience in development of android application. I did few researches. Let me explain my problem. I am making an android app to show a details of a university. I used a WebView to display the results from a HTML & CSS page it was very easy for me here is a demo. I thought of using JSON for fetching data form the database. Now I am not sure how to populate it. Please suggest me a way to populate the same data as in that example page.
I have visited http://android.stackoverflow.com but in FAQs I found this question shouldn't be asked there. I hope I am asking it in the right place.
You can populate your data using Listview. You can use a custom or default adapter for setting it in the ListView. And you don't need to use JSON for fetching data from database. You can fetch data from database using Cursor.
For such a simple solution with low amount of data you might also consider to create a pure mobile web-application using a JavaScript based template systems. It would suffice as an pragmatic approach.
The templates also provide flexibility at later points during your development cycle when you may switch the underlying software-platform (for instance from a web to a native app)
I recommend PURE or handlebars.
See
Overview of client-side web templating systems
Embedded.JS
handlebars.js
pure (Simple and ultra-fast templating tool to generate HTML from JSON data")
stackoverflow: Javascript template system - PURE, EJS, jquery plugin?
I am developing an android app where I will provide a button on which, when ever the user clicks, they will get the live score updates of the Soccer game.
Are there any tutorials for that or, any Open-source code available for that
I am trying to achieve some what like the image given below:
Your required tasks is pretty straight forward. I suggest you use the android developers site to learn the basics and tool stack involved in android programming. Early in this process you will come across the 'Views' tutorial which outlines about half of what you need to do (display the scores in a pretty format).
I suggest you get this part of it running first (just a pretty display with test scores on it), after that creating the network request and getting the data from the server should a fairly easy path using Android's or apache HTTP classes.
You would somehow have to retrieve the current score from a server.
You would basically need a site which can provide you the live data in an xml format, for instance. There are sites which provide this. Of course, they won't provide it for free. May be you would get it free for some smaller league for you to test.
You can simply read the xml, using xml serialization or maybe XmlDocument if you use c# as a language for scripting.
I did a simple google search, and I found this article by www.thegamecontriver.com, they use unity to create a Live Standing App. Maybe you will find this useful. Of course, it is not difficult to use the same method to do it for Live Scores.
You can find the link for the post here
Live Standings App Tutorial