The best way to transfer data from mobile - android

I want to develop client - server system (client is mobile). What the best way to transfer the data from server and to server? Using RESTful-architecture? HTTP requests? use JSON or XML?
If there isn't best way what is the advantages and disadvantages of each method?
Thanks for helping.

This is a very subjective question. You can use anything to transfer data to mobile devices, even a direct socket binary transfer. But as you have stated, one of the most popular methodologies is to use a REST-ful JSON interface. There are good libraries that support this system both on the client and server. The other option which is not as popular anymore is using XML/SOAP. Many people loathe XML/SOAP at this point, some don't mind. Of course, there are many others I will not mention.
As I stated before though, this is a subjective question. If I were to do this work, I would do REST/JSON, but it certainly is not the only way.

Related

Using parse on a web hosting

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.

Android application interacting with a server

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.

Android, REST, and HATEOAS constraint

So I'm building a mobile app which will be using a RESTful web service (which I am also writing myself)
After lots of research I have a few questions regarding mobile apps and the HATEOAS constraint.
I usually use the Gson library for parsing objects without the HATEOAS constraint and it has been proven to be really efficent. For HATEOAS however, I am thinking of using Gson for the deserialization and Json-HAL for the response format.
How do I parse all of the _links and _embedded resources in my application without making the deserialization process tiresome? Some objects could have "embedded" resources and some don't. How should I create my data model objects to support all of these new tags? I am pretty lost on this part so I would appreciate an example.
Does anyone have any tips implementing this constraint on mobile apps?
If you think HAL or Json is not the right choice for mobile, please let me know.
Implementing this constraint for mobile seems like overkill to me.
Please enlighten me, Thanks!
Bit late to the party, but I feel that the best way to solve this is, summed up:
Yea HAL is a good format.
Treat things in _links and things in _embedded both as links. They are really the same 'thing'.
The difference with _embedded compared to _links though, is that _embedded really should pre-populate your cache. So whatever you receive their should be added to some kind of cache which should make future GET requests unneeded for those resources.
The benefit of this approach is that it now becomes possible for the server to 'promote' links from _links to _embedded and have your client automatically adapt to this and make less HTTP calls.
References: (disclaimer, I wrote both)
The problems with embedding in REST today and how HTTP/2 might solve it.
Restl, a hypermedia client for javascript

Android Webservice, REST or SOAP WSDL?

I need to synchonize some data accross different phones. For example I want to enable "friends" to (automatically) share notes...
I'm now wondering what would be the best approch to reach this.
At the moment i think I'll have to write my own webservise to reach this goal.
As I started to think about a SOAP webservice I found lots of people saying that they would prpose a REST approach.
What would be the "better" solution in my case or are there any other approches for synchonizing data on different Android phones?
Maybe I should start by mentioning that REST is not a protocol and as such hard to compare to SOAP which is.
The main disadvantages with using SOAP for mobile applications are that it normally uses XML and thereby more data than most other protocols and that it's fairly complex both to set up and to maintain. On the other hand, if one party writes the server and one the client, SOAP gives you good ways to see to that changes are communicated clearly (ie WSDL). SOAP is generally not very well supported in mobile phones and may require third party libraries to make it work.
REST is often (mis)used as a name for HTTP based communication using JSON, which is a pretty easy way to communicate with mobile devices and has low overhead. If you have control over both server and client, it's not the wrong way to go (but not the only one either) JSON is generally very easy to get to work on all mobile platforms, and HTTP is well supported by the phones themselves.
It's better to use REST than SOAP because SOAP is very verbose and will increase the network data size.
Besides, if you use SOAP, you have to include external librairies (like kSOAP) to consume the response. With REST, a standard HTTP client is OK.
About data format: think about JSON that is less verbose than XML.
Concerning synchronization, I don't know if Android SDK provides classes to perform this work.

Android:REST webservice

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!

Categories

Resources