Network programming in Java for Android

There are a number of ways to demonstrate networking features for mobile devices. Almost everyone nowadays has a smartphone that has access to the internet – allowing for developers to utilise these features to create interesting games and useful apps.

In my 3rd year of university I created an android game which makes use of several different networking features:

  • Local databases
  • Remote databases
  • Location services


The game itself is a simple clone of doodle jump. The game uses the accelerometer in the device to calculate the orientation of the device – this is how the player controls the game. Here is a short gif of the game being played:



When you play the game, your score is always automatically added to a database local to the device- This is the local highscores. From this point, you have a choice to add it to a remote database which is the global highscores.

To test the remote database, I used wampserver which hosts a server on the computer it is running on. From here, I connected my phone to the network and accessed the database. To communicate to the server, the app uses PHP files to retrieve and alter the database files.

Location services

To demonstrate the use of location services for a mobile device, the longitude and latitude co-ordinates of the current location is sent along with the players score to the database. Although this is not the ideal use for location services, it is used solely as a demonstration of the implementation.

After a location has been sent to the database, the player can access the database and click on any of the scores. When the player clicks on the score, the co-ordinates are sent to a maps activity, which shows the location on google maps.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s