I am making a game. The client runs in android. It is multiplayer and I want to check as much logic as possible on the server. I am interested how to connect the android client to the pure-java backend. I dont want to deal with the pure sockets as long as it creates a lot of programming overhead. Something like EJB would be perfect, but as long as can see, there is no rmi package in Android or anything. So the only way is connecting it throught Sockets or URL-objects to the REST-service (Could connect with URL to SOAP-based service - but its too complicated to do by hand). Serialization does not work between android and java. What is the best way to connect an Android app in a multiplayer game to the server (better java EE EJB`s or something)? Is there a way except pure XML?
You can use JAX-RS to build a RESTful Webservice, and you can use JSON as the payload. Jersey is a reference implementation, and is a good one. There is JSON support as well.
Related
I have to build a server to which I make requests using Unity for a mobile game.
I was advised to stay away from using REST for the server.
I want to be able to, in the client, make GET and POST requests via endpoints like "/players".
My question here is: which programming language and programs do you recommend me to start with to build a server to which clients can communicate with, in this case?
I've been using NodeJS to write servers for my programs and I've found it really good for a couple of reasons:
1) It is easy to understand the syntax (JS) if you've been using UnityScript or C# in the past.
2) There is a free download from the Asset Store that helps you parse and send data from a NodeJS server.
I am handling my second year project which includes some machine learning backend along with a Mobile application front end.In simple terms i am creating
a androing/react native application which would take an input from the user and prosses in a backend development which includes python for some machine learning.
My question is, is it possible to connect these 2 together. I have gone through some stuff altho i am not very clear on how to create a connection on this.
Also some opinions on either i should go with android or react native or any other language to go on python or not would be very useful.
Thank you
Yes, it is possible.
For example, you can use Python as backend (server), with some exposed HTTP "interface", then make an Android application that communicates with these Python backend with HTTP request / response.
Or, if you are making a serverless application, you can make this Python backend as a .so library or using SL4A then call them in your Android application.
Yes. you can develop a python web service (REST OR SOAP) and use this for the backend for your application.
also, if you develop a service application (server-client) you must develop a service with python (or any languages) in your server after that connect your mobile application (reactjs, android studio, swift, ...) to this server.
I recently started developing my first web application with Spring and I'm stuck with a question I could not really find an answer to. What I have is a simple Spring MVC application running in tomcat which provides data in form of JSON, XML or binary via REST. This service is consumed by two clients I developed, a simple Java desktop application and an Android app. So far the clients only got information about new data by polling.
What I want now, is a way for the server to send notifications/messages to the clients when new data is available. For the Android client it would be good if the notifications could received anytime, not only when the app is currently open of course. I found lots of information for JavaScript client code but very little really useful, up-to date input about what the options for java and android clients are.
It would be really great if someone could give me some idea what would be the best way to achieve what I want (ideally something which integrates well with Spring on the server side), what protocols/libraries/frameworks to use, maybe even point me to some example or tutorial, how to implement this on server and client side.
Thanks in advance for any input.
For android or mobile devices, Google Cloud Messaging is the preferred way of sending messages to applications running on devices.
Example : spring gcm server side project and a sample tutorial.
For desktop apps, either poll regularly the server or run something in background like crontab or active-mq to check the messages and start the desktop app.
WebSockets are the best solution. check the implementation in java in the server side
I am new at using Codename One. I am trying to deploy a server that will interact with my app on Amazon Web Services using OpsWorks. The server is going to run on Apache Tomcat and be a dynamic web project written in Java, and I am wondering the best way to communicate with the Codename One client. I am planning to use the Socket classes provided by Codename One, but and not sure what to use for the server-side code. Will it work to use WebSockets from Apache? I am having difficulty debugging the server code and have hit a wall here. Thanks in advance!
WebSockets aren't compatible with sockets so you will need to code a websocket implementation which is a bit of work. I suggest you use HTTP communication which is more portable and very performant on the devices.
You can also use solutions such as PubNub which allow for fast message based communications.
Here is the background of my situation:
I want to create an iPad application that interacts with a oracle SQL database. I have existing Java code from my Flex application that handles all the database requests, and modifications using the Spring Framework. The Flex Application ran as a web service through TomCat. Now I want to make that flex application into a mobile iPad version. I am having trouble figuring out what is the easiest way to use existing Java code and use it for the iPad because the iPad interacts using URL requests instead of direct with the Java.
My question is, can I use the existing Java code with the Spring framework to save time from coding all the back-end handling? Basically I want to access all the classes from my Java code by doing Requests from the iPad. Is this possible and will I need JSON or XML to interact between the iPad and the Java code?
Summary:
Can I use
iPad Objective-C <-----> Java (with spring framework) on TomCat Web Service to handle oracle SQL data handeling? If so, how and what technologies do I need? Will I need JSON or XML and how does that factor between the iPad and Java?
Thanks!
A good approach would be to design your app to communicate with RESTful services that return JSON. Once this is done your iPad app doesn't have to even know that the server code is written in Java.. it's just interacting over HTTP.
Here's a good tutorial on setting up your tomcat to host your RESTful services: http://www.vogella.com/articles/REST/article.html - I've used this for an app I'm developing. Spring isn't even necessary.
You could go XML, but JSON is just easier in my opinion. Here's a good blog outlining the good and bad of both sides. http://digitalbazaar.com/2010/11/22/json-vs-xml/
OK, I'm making the following presumptions.
Your flex application runs on a different machine from the Tomcat
server
Your flex application makes web service calls to the Tomcat server
So, the flex application doesn't know the underlying technology that provides the web services. It's just seeing/consuming the output
There's no reason why the iPad app can't do the same thing. There's no reason why it can't use the same web services that the Flex application uses. It could consume the same messages (Assuming it can handle the request/response format currently employed by the Flex application).
You can make changes if you like if you want to change the structure of the requests/responses between the clients. But the clients don't know (nor care) how the web services are implemented. They are just requesting and consuming info.