File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Android and the fly likes Bluetooth serversocket in background Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Bluetooth serversocket in background" Watch "Bluetooth serversocket in background" New topic

Bluetooth serversocket in background

Matthew Tilic
Ranch Hand

Joined: Apr 07, 2011
Posts: 41


I have made a game where you navigate a map and have to find an object. It is a very simple sprite game and now I want to now make it so that two players will communicate with each other so they can effectively race against each other.

The idea is to make one of the phones the "Server" and the other devices (as may make it for 3-4 players to play against each other) will connect to it and then when they have got the "item" send the time it took to complete to the server.

This will then wait for the others to complete the game and the collect the times. My question is how do I best run the bluetooth server socket in the background of the "Server" phone which will want to play the game as well as being responsible for collecting all the data.

I have read that using a service would be a good idea but I have never made one so not sure how communication between and activity and service would work.

Many Thanks
I agree. Here's the link:
subject: Bluetooth serversocket in background
It's not a secret anymore!