summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--same-android/AndroidManifest.xml2
-rw-r--r--same-android/src/main/java/com/orbekk/discovery/SameService.java (renamed from same-android/src/main/java/com/orbekk/discovery/DiscoveryService.java)16
2 files changed, 9 insertions, 9 deletions
diff --git a/same-android/AndroidManifest.xml b/same-android/AndroidManifest.xml
index 66ceb4f..332cade 100644
--- a/same-android/AndroidManifest.xml
+++ b/same-android/AndroidManifest.xml
@@ -11,7 +11,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
- <service android:name="com.orbekk.discovery.DiscoveryService"/>
+ <service android:name=".discovery.SameService"/>
</application>
</manifest>
diff --git a/same-android/src/main/java/com/orbekk/discovery/DiscoveryService.java b/same-android/src/main/java/com/orbekk/discovery/SameService.java
index e9aac5f..149b882 100644
--- a/same-android/src/main/java/com/orbekk/discovery/DiscoveryService.java
+++ b/same-android/src/main/java/com/orbekk/discovery/SameService.java
@@ -12,15 +12,15 @@ import android.widget.Toast;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class DiscoveryService extends Service {
+public class SameService extends Service {
private Logger logger = LoggerFactory.getLogger(getClass());
- private Thread thread = null;
+ private Thread discoveryThread = null;
public final class DiscoveryThread extends Thread {
Broadcast broadcast;
public DiscoveryThread() {
- broadcast = new Broadcast(DiscoveryService.this);
+ broadcast = new Broadcast(SameService.this);
}
@Override public void run() {
@@ -42,7 +42,7 @@ public class DiscoveryService extends Service {
private Handler toastHandler = new Handler() {
@Override public void handleMessage(Message message) {
- Toast.makeText(DiscoveryService.this,
+ Toast.makeText(SameService.this,
(String)message.obj, Toast.LENGTH_SHORT)
.show();
logger.info("Display toast: {}", (String)message.obj);
@@ -58,10 +58,10 @@ public class DiscoveryService extends Service {
public int onStartCommand(Intent intent, int flags, int startId) {
Toast.makeText(this, "service start: " + intent.getAction(),
Toast.LENGTH_SHORT).show();
- if (thread == null) {
+ if (discoveryThread == null) {
synchronized (this) {
- thread = new DiscoveryThread();
- thread.start();
+ discoveryThread = new DiscoveryThread();
+ discoveryThread.start();
}
}
return START_STICKY;
@@ -70,7 +70,7 @@ public class DiscoveryService extends Service {
@Override
public void onDestroy() {
Toast.makeText(this, "service stopped", Toast.LENGTH_SHORT).show();
- thread.interrupt();
+ discoveryThread.interrupt();
}
}