summaryrefslogtreecommitdiff
path: root/same-android/src/main/java/com/orbekk/same/SameService.java
diff options
context:
space:
mode:
authorKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-02-28 16:34:57 +0100
committerKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-02-28 16:34:57 +0100
commitbf8e87bec12e6ec53ec2150d7a6f6d0e493c79ce (patch)
tree35f334042ce8db5158b1f72ca0fe55233ce5780f /same-android/src/main/java/com/orbekk/same/SameService.java
parent9635b25d879052210dc3cae314efad512c373c0a (diff)
Fix concurrency problems.
– GameView should only draw on canvas from UI thread. – ClientInterfaceBridge should not delete state after disconnect (Because an update may be still waiting.) – Send a Bundle in JOIN_NETWORK request to SameService.
Diffstat (limited to 'same-android/src/main/java/com/orbekk/same/SameService.java')
-rw-r--r--same-android/src/main/java/com/orbekk/same/SameService.java22
1 files changed, 5 insertions, 17 deletions
diff --git a/same-android/src/main/java/com/orbekk/same/SameService.java b/same-android/src/main/java/com/orbekk/same/SameService.java
index b7ba0ca..f99eb68 100644
--- a/same-android/src/main/java/com/orbekk/same/SameService.java
+++ b/same-android/src/main/java/com/orbekk/same/SameService.java
@@ -24,9 +24,12 @@ import com.orbekk.same.config.Configuration;
import com.orbekk.util.DelayedOperation;
public class SameService extends Service {
- public final static int DISPLAY_MESSAGE = 1;
public final static int SEARCH_NETWORKS = 2;
public final static int CREATE_NETWORK = 3;
+
+ /**
+ * masterUrl: getData().getString("masterUrl")
+ */
public final static int JOIN_NETWORK = 4;
public final static int ADD_STATE_RECEIVER = 5;
public final static int REMOVE_STATE_RECEIVER = 6;
@@ -87,21 +90,6 @@ public class SameService extends Service {
class InterfaceHandler extends Handler {
@Override public void handleMessage(Message message) {
switch (message.what) {
- case DISPLAY_MESSAGE:
- Toast.makeText(SameService.this,
- (String)message.obj, Toast.LENGTH_SHORT)
- .show();
- Messenger responseService = message.replyTo;
- if (responseService != null) {
- Message response = Message.obtain(null, DISPLAY_MESSAGE);
- response.obj = "Response from SameService";
- try {
- responseService.send(response);
- } catch (RemoteException e) {
- logger.error("Failed to respond.", e);
- }
- }
- break;
case SEARCH_NETWORKS:
logger.info("SEARCH_NETWORKS");
sameController.searchNetworks();
@@ -112,7 +100,7 @@ public class SameService extends Service {
break;
case JOIN_NETWORK:
logger.info("JOIN_NETWORK");
- String masterUrl = (String)message.obj;
+ String masterUrl = message.getData().getString("masterUrl");
sameController.getClient().joinNetwork(masterUrl);
break;
case ADD_STATE_RECEIVER: