简体   繁体   中英

Android app need help connecting to a JAVA localhost server

I've had a look around and could not find what I'm looking for, so please feel free to redirect me.

I'm writing a card game that uses a Java server that stores the card information. I want to develop an Android app that connects to this server (via TCP/IP is my initial thought) and issues the commands ie pick up cards, play cards etc. (as the cards are stored in arraylists within the server app.)

My knowledge of Android is extremely limited and I cant find any good sources that could possibly help me, or explain how android networking works.

You need tcp server socket communication >

http://developer.android.com/reference/java/net/Socket.html

I would recommend to use a REST service and communicate via JSON. You can use for example Robospice in combination with Jackson2 which also brings you async communication and caching out of the box. https://github.com/stephanenicolas/robospice/wiki/Starter-guide

Socket communication is really old school ;-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM