am 690af66e: am 4397f185: am e3912a4a: Fixing a crash caused by using implicit intent when starting a service
* commit '690af66ea641e7324d5f3dc4c30195a53de43148':
Fixing a crash caused by using implicit intent when starting a service
diff --git a/wearable/wear/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/MainActivity.java b/wearable/wear/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/MainActivity.java
index 982e3de..2e132a8 100644
--- a/wearable/wear/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/MainActivity.java
+++ b/wearable/wear/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/MainActivity.java
@@ -55,11 +55,12 @@
}
};
mHistoryView = (TextView) findViewById(R.id.history);
- startResponderService();
+ startResponderService(ResponderService.ACTION_INCOMING);
}
- private void startResponderService() {
- Intent serviceIntent = new Intent(ResponderService.ACTION_INCOMING);
+ private void startResponderService(String action) {
+ Intent serviceIntent = new Intent(this, ResponderService.class);
+ serviceIntent.setAction(action);
startService(serviceIntent);
}
@@ -69,9 +70,7 @@
LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver,
new IntentFilter(ACTION_NOTIFY));
mHistoryView.setText("");
- Intent serviceIntent = new Intent(ACTION_GET_CONVERSATION);
- startService(serviceIntent);
-
+ startResponderService(ACTION_GET_CONVERSATION);
}
@Override