summaryrefslogtreecommitdiff
path: root/same-android
diff options
context:
space:
mode:
authorKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-02-13 20:08:38 +0100
committerKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-02-13 20:08:38 +0100
commit5190cf7a9b1db1ef0d7cac007ce73aff248203f0 (patch)
tree4ee4133815e75957a37055a890ffe873db38272d /same-android
parent6837a4482f1b922962028010ce690146b4aef349 (diff)
Fix network notification.
NetworkNotificationListener in SameService passes networks correctly to listening activity. Activity displays networks.
Diffstat (limited to 'same-android')
-rw-r--r--same-android/src/main/java/com/orbekk/SameService.java20
1 files changed, 10 insertions, 10 deletions
diff --git a/same-android/src/main/java/com/orbekk/SameService.java b/same-android/src/main/java/com/orbekk/SameService.java
index 18d7dee..305bf44 100644
--- a/same-android/src/main/java/com/orbekk/SameService.java
+++ b/same-android/src/main/java/com/orbekk/SameService.java
@@ -41,13 +41,20 @@ public class SameService extends Service {
private SameController sameController = null;
private Configuration configuration = null;
+ // A list with alternating network names and urls.
+ private ArrayList<String> availableNetworks = new ArrayList<String>();
+
private NetworkNotificationListener networkListener =
new NetworkNotificationListener() {
@Override
public void notifyNetwork(String networkName, String masterUrl) {
- Message message = Message.obtain();
- message.obj = "notifyNetwork(" + networkName + ")";
- toastHandler.sendMessage(message);
+ logger.info("notifyNetwork({})", networkName);
+ availableNetworks.add(networkName);
+ availableNetworks.add(masterUrl);
+ Intent intent = new Intent(AVAILABLE_NETWORKS_UPDATE);
+ intent.putStringArrayListExtra(AVAILABLE_NETWORKS,
+ availableNetworks);
+ sendBroadcast(intent);
}
};
@@ -68,13 +75,6 @@ public class SameService extends Service {
Toast.makeText(SameService.this,
(String)message.obj, Toast.LENGTH_SHORT)
.show();
-
- Intent intent = new Intent(AVAILABLE_NETWORKS_UPDATE);
- ArrayList<String> networkList = new ArrayList<String>();
- networkList.add("FirstNetwork");
- intent.putStringArrayListExtra(AVAILABLE_NETWORKS,
- networkList);
- sendBroadcast(intent);
break;
case SEARCH_NETWORKS:
logger.info("SEARCH_NETWORKS");