I have seen the video http://www.youtube.com/watch?v=xHXn3Kg2IQE and it was very interesting.But any one have implemented the REST web service using the services.I am developing the chat app,i need to call the web services in some interval if any one done it then please send me idea about it.
Thank you.
I know you've seen my question about the android restful API service, and think you can do something similar the the answers stated there. You'll need to use a Handler to execute a timed callback from the service.
Also, since that question was answered I've discovered google buffers which may be worth you looking at:
Protocol buffers are a flexible, efficient, automated mechanism for serializing structured data – think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages. You can even update your data structure without breaking deployed programs that are compiled against the "old" format.
There are some good examples on the tutorial pages - it'll make your chat client super fast!
Related
Ok so, I know the question is pretty much google-able and I did google it and found out a few answers ,so I am not asking this question knowing completly nothing.
So, I have an application (Cannot specify much about what it does or is or so...) and I need to get some data from a database.
As far as I know, the Volley is the best way to go ,but I am still looking for more details.
Could anyone tell me which is the best way to go?
NOTE: I am NOT looking for code,I am looking for methods.A name would sufice ,as I can do the digging myself.Eventually links to documentations would be awesome, but again, I can find documentations.I just need to know which is the fastest way and the most optimized.
Based on your comment, it looks like there are two different aspects to your application:
Sending out the HTTP requests from your client- i.e. your android app
Processing and sending the response to these requests on the server side, by setting up a web service
Looks like you have part 1 figured out. Note that, volley is a library, similar to android HTTP library, but optimized for faster networking.
For part 2, unless you're planning to use embedded database like sqlite, you'd need to learn about writing web services to provide database access.
Spring Data JPA is one of the many ways to do it.
I hear Parse is great too, but not free.
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'm working on an Android application which is fetching data from internet among other things. Actually, the project was started by someone else which is not here anymore,
and now that I have to turn it into a light client application and implement the server side (in Java), I'm wondering what would be the best tools/patterns to use to fit my needs.
Let's say I have to deal with several models (class representing a category) of objects which all inherits from one class : they have common attributes (such as name, attache thumbnail...) but specific properties too.
Because of this,you can understand that I can't afford to manage one specific table to map each single class.
However, I still want to be able to cache my objects somewhere in the Android device to populate the views of the application when working in offline mode.
Currently, the solution used by the previous developer was to store data directly into a TEXT field in the SQLIite database, as serialized objets.
This should be ok on the server side but I've read that the usual Java serializaton was very slow on the Android platform, although it is not really noticeable now because I work with around ~50 objects, I was looking for more performant alternatives for the future.
I've came across the JSON solution which can easily handle complex structures and Jackson library seems very interesting with its simplified data binding to POJO objects and its well-known performance.
But then, how should I store my Json objects ?
Is it possible to keep a json string in a TEXT field of a SQlite table ?
Or should I rather store them as .json file for each object ?
Which one is the more efficient to retrieve later lot of data?
Plus, I was thinking that JSON would be a very good exchange format between the Android client application and my server whould is in charge of processing the information from internet third-parties apis and exposing this data with webservices. (rather than trying to implement some RMI-like solution)
Is using the usual Apache HTTPClient enough on Android to communicate with the server?
For those who successfully developped client-server application (which seems very common to me) is this a good approach for Android ?
It seems to me that with mobile platforms, you can't really use the approach that you've learned for more classic J2EE app and such...
Any advice would be greatly appreciated because I'm a student and Android beginner who really want to improve her mobile development skills !
Thanks :)
That's open to discussion, so SO is probably not the best place to ask. In general, before declaring something is too slow (or fast), measure, compare and pick the one that works best for you. Yes, you can save JSON in a DB, an it will generally be faster than having separate files on the FS. But, again, benchmark and compare.
BTW, most J2EE 'approaches' (patterns) are overkill for any platform, let alone mobile.
I am developing application for iPhone and android. In code i need to access the data from database(oracle) .
I am planning to use REST web services to return JSON data to devices. I dont know much about developing web servies(all i did is 'consumption' part).
Now the question came to my mind, i can still manage to return the JSON data from java servlets.
IS there any advantage of using web services. I know for sure I am missing something but want to know what is it.
Now the question came to my mind, i can still manage to return the JSON data from java servlets.
Yes, you can return JSON from java servlets. There are plenty of libraries out there for taking what ever data you've retrieved from you database and serializing it into JSON.
IS there any advantage of using web services. I know for sure I am missing something but want to know what is it.
This is a super general question, but yes. I think the best answer is that (among other things) it gives you an API that arbitrary clients can plug into. So you can expand to new platforms trivial. That's the main benefit as far I see it.
I have a WCF RESTful application I wrote based off of WcfRestContrib and hosting in iis7.5, which passes a pdf as a byte[]. I'm trying to figure out how, and what the best way would be, to consume this service in an Android application. I believe I took care of all the Java/WCF interop issues because the service is used by an outside company that uses java. But I don't see to many examples out there. I've read that I'm going to have to make a method that passes JSON instead XML, but otherwise I believe it should be usable for an Android app. I'm not seeing too many examples of Android apps that consume RESTful services, is this not the preferred method for Android?
I seen a couple articles (http://romenlaw.blogspot.com/2008/08/consuming-web-services-from-android.html) but most seem kind of old, though they still may be useful. I'm just curious how any experts out there would suggest I handle such a project, I can create another kind of service if need be. I just want to be able to load pdf's from a service based on some parameters. Security is a concern, but not mandatory at this stage. Service currently uses basic auth and is on a https.
Any thoughts? Suggestions?
While also adressing your security concernt, you could use an HttpsURLConnection and then use getInputStream() from that to put it in a bytearray using read().