Android application interacting with a server - android

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.

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 backend

I want to make an android application which will display an external message (For example: some quotes, proverbs etc) daily.
The message should be retrieved from some place other than the client device and I would like to configure the messages from back end
These messages should also change everyday.
How should the back end be and how can the android application retrieve the configured message ?
Do I need a server at the back end for the same or can avail some cloud services for the same ?
What is the best approach to do?
If you want to avoid having to set up and manage a server on the backend yourself you can take a look at a 'backend as a service' offering.
Two example candidates are:
https://parse.com
http://aws.amazon.com/lambda/
Both Parse and Amazon provide SDK's to allow you interact with the backend from your Android app.
You will likely want to study this a little to decide if you want this type of solution or to build your own server as Brian suggests - I think there are pros and cons to each approach and you'll have to choose which is best for your case.
Yes, you will need a server. You can start building the server software on the same machine as your Android emulator and create them in parallel. You'll need to choose a language and most likely a web server framework that suits your thought process and style.
If you want to use REST, for instance, google some for "best REST server framework". You will get hundreds of answers that don't mean much, but look at the communities that surround the frameworks that come back. Look at the user lists and how many questions about it exist on this site. That will give you a better idea of whether you can ask questions and get answers when they arise. You are making an investment by learning a framework, spend a little time deciding which one you are going to use, possibly by trying a few of them for a very simple site that returns the kind of data you are looking for.
Other than that, you really need to ask specific questions once you've chosen a language and a framework. Hope that helps.

Android application consuming WCF/RESTful service

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().

How to use webservices in android?

I want to know about how to call webservices in android I had done a lot of search from Internet and have read several tutorials but was not able to understand much and manipulate, can anyone suggest any Tutorial, or provide any Pdf file or any book related to web services so that I can understand it.
Thanks in advance
The first reading I would suggest is this one - this is the W3School tutorial. Don't forget to read the related chapters included in this tutorial - Soap, Wsdl, etc - as this tutorial taken as a standalone would not be so valuable. This tutorial is not specifically related to Android but will give you all the information needed to understand the use and constraints of this kind of architecture, and then structure your project.
Under Android, you will face the specific contraint of mobile phones and tablets: the network can be down, and is often down: in the tube, in a basement, in any area that have a bad network coverage. So you will have to take care of this, either by caching data or allowing the application to work in degraded mode when no network is available. These are just examples as I don't know your context.
After that, Android is developed in Java, with a specific API that comes on top of the regular java.* packages. These are just tools to implement the client side. On server side, depending of whether you control these services, you may also have some implementation to do. If so, this can be Java, PHP, .Net, anything: one of the purpose of the web services architecture is to stay independant of the remote implementation to only care the exchange protocol. But reading your question, I think the two first points are more important (or have an higher priority let's say) than the implementation as they are prerequisites. (EDIT: Anyway, a useful discussion about that can be found here on StackOverflow.)
Android Doesn't have it's own tool then you should use your own or use some Thing Like KSOAP2.
You Can Use This.
http://www.c-sharpcorner.com/UploadFile/88b6e5/how-to-call-web-service-in-android-using-soap

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