Web Server vs. Socket Server for android app - java

After a lot of research i am more confused then before on what kind of server to use for an android app.
My question in a nutshell is: which kind of server is easier to use and deploy.
I want to create an android application that communicates with a server to find other clients, the server uses GCM to notify other clients that one client wants to communicate and is used to exchange the address of the clients. Afterwards the clients should be able to communicate directly to one another.
What i found out is that from the android point of view either would be fine, both is likewise possible and neither produces more work then the other.
On the server side it looks like web service would be better to use, because it is easier to find a server provider. I might be wrong here but it looks like most large server providers don't like to give you enough access to run a jar file.
Google and amazon offer servers that can host web services, i am not sure if a socket server would be possible there, so if anyone can give me some tips on good and affordable server providers i would also like to have some insight there.

Related

Fetching Data From Cloud Server

I am working on an android application which needs to fetch data from a cloud server . I know how to send a post request to a server and get data in return but i have never worked with cloud server before . https://developer.android.com/guide/topics/data/backup.html
i have visited this website but it's not that much of help to me i am confused as to how to send request to the server and retrieve data . I don't know anything about cloud servers .
A cloud server is just a normal server hosted in a some 'cloud providers' data centre. It is typically a virtual server - i.e. a single physical server running multiple virtual servers.
From your point of view you can think of it as just a regular server.
What may be causing confusion is that there are also 'Mobile Backed as a Service' providers - these allow you interact with servers, typically ones hosted in a cloud, but may allow you interact with them using a mobile SDK (or library) rather than using traditional client server communication. Your app usually needs to know nothing about the individual servers and you yourself don't need to create or manage any servers either.
Take a look here for a good overview of this latter approach:
https://parse.com/docs/android/guide

EJb, direct ServerSocket or any other implementation

I am working on a Chatting Website project which will provide similar features as was like yahoo messenger with chat rooms...
Where multiple clients will connect to the central server and chatting(communication) and file sharing(if possible) will take place.
Now i did a bit of research and i came out with the following choices:
For the client i will use either Winforms or WPF with c#
And for server I am confused between,
Direct Servesocket based application to be deployed on a VPN or a dedicated server,
or EJB based something,
Or any other technology as you may suggest to be suitable for this.
kindly keep somethings in mind:
1. It should be scalable enough to be able to sustain 100 - 1000 to 1,00,000 clients
2. Server should also serve android app as client end.
3. Deployment details also requested

Sending and receiving data from an Android application to a web hosted Java application

I've been looking around all morning, and can't seem to figure this one out. I know it's not as complicated as I think it is, and all I need is just some pointers to the right direction.
I have an Android application that takes some user input, sends it to a Java application over the web, and then receives some output based on the input.
My Android and Java applications are ready, but how do I go about sending and receiving the data over the web? I understand that I'll be sending and receiving HTTP requests, but my problem is where I'll be sending them and receiving them from. Do I host my Java application on a Servlet like Tomcat, or do I use something like OpenShift to host my application for me?
I have no trouble with sending some HTTP request from my Android application to the web and receiving some output back, but my problem is that my web service needs to use a Java library to process the input and generate the output. I'm just not sure how I'm supposed to get this data to and from this Java library that needs to be hosted on the web.
I hope my question makes any sense.
EDIT: Perhaps I wasn't clear with what exactly I need help with. I do realize that the architecture I use doesn't really make any difference, but the problem I have is with how I'm supposed to use this architecture.
Let's say I have a registered domain name that I can easily send to and receive data from using my Android application - no trouble with that. But how am I supposed to integrate my Java library with this server? Do I just create an applet and put it on my server? Does my web host even allow Java applets to run?
I guess my question is how I'm supposed to get through the "barrier" between my HTTP request / transport layer protocol and my Java application.
Server architecture usually does not matter. You can use Java, NodeJs, Rails, Python, .NET, etc. You just need an endpoint that accepts a HTTP POST/PUT/GET/DELETE/PATCH verb.
This is more a question of "how do I set up a server to accept input" and its a very large topic in itself. I would advise you look at PAAS solutions like:
Parse.com
Kinvey.com
You can use their tools to build a solution fairly quickly. If you need something custom you'll need to build your backend in the language of choice and host it online via AWS, Google Cloud, Heroku, a VPS or something similar.

How to share database between same application in multiple devices without server

I have created database in one application and that application is installed in multiple devices.My requirement is that if i change the value in database of one device then,that changes in database should reflect in another device of same application.I need it without server/third api.
Thanks in advance...
This is precisely when one does need a sever.
Stop and consider what it is that you are asking for. You need a way for a phone to notify all other phones that hold the same application about a change. Phones are not directly addressable to each other via the web, which makes any kind of peer to peer algorithm tricky. SMS texts is the closest form of direct addressing that phones do support, thus it could be used to build a peer to peer protocol, but that would be tricky, unreliable and is unlikely to be beneficial.
A server on the other hand is the standard approach to solving this problem, the server acts as a shared agent that all phones that connect to the web can address easily. Even if the server is just an FTP server on a freebie hosting site.
You need to implement a server functionality in your android application.
What is a server : A server is a running instance of an application (software) capable of accepting requests from the client and giving responses accordingly. Servers can run on any computer including dedicated computers, which individually are also often referred to as "the server".
For further information,I would like to provide this link which will clarify you about communication between two devices Android - communicating between two devices (Use of bluetooth etc.)

Real-time web service java using axis2

Purpose:
I'm trying to make a real-time web service in Java. When there're changes in database, the data in clients(probably Android client) will be changed automatically without refreshing.
Platform:
I'm using Tomcat 7 container and Axis2.
Problems:
I'm stuck in the way to approach. I've realized that there were 2 ways:
1. When the data in server changes, notice to all the clients. Web-service allows us to do this, but I don't know what clients I have to inform!
2. Clients connect to the server, keep the connection alive and whenever there's a change, update data. However, if the client is the handheld, it will consume much power and data exchange over 3G network.
I know that's a complicated problem. So I just want to ask if there is an efficient way to approach? And if possible, anyone can give me one example of realtime web service like this?
I've searched over many pages, but nothing's helpful. Can anyone give me some suggestions? Tkx!
Is it a requirement to use webservices or Axis? Otherwise, you might be interested in WebSockets. These are connections over plain HTTP that provide two way communication. Your clients will connect to your server, and as soon as new data is available your server can push data to every connection it knows of, thus informing all clients that are connected.

Categories