diff --git a/org.eclipse.paho.android.service/src/main/java/org/eclipse/paho/android/service/tasker/TaskerMqttService.java b/org.eclipse.paho.android.service/src/main/java/org/eclipse/paho/android/service/tasker/TaskerMqttService.java index 7cd1b12e..6dbaae27 100644 --- a/org.eclipse.paho.android.service/src/main/java/org/eclipse/paho/android/service/tasker/TaskerMqttService.java +++ b/org.eclipse.paho.android.service/src/main/java/org/eclipse/paho/android/service/tasker/TaskerMqttService.java @@ -84,13 +84,8 @@ public int onStartCommand(Intent intent, int flags, int startId) { ProcessStopServiceAction(); break; case TaskerMqttConstants.QUERY_SERVICE_RUNNING_ACTION: - boolean running = ProcessQueryServiceAction(); - if(running){ - return START_STICKY; - } - else{ - return START_NOT_STICKY; - } + ProcessQueryServiceAction(); + break; case TaskerMqttConstants.QUERY_PROFILE_CONNECTED_ACTION: ProcessQueryProfileConnectedAction(data); break; @@ -288,18 +283,18 @@ private void ProcessUnsubscribeAction(Bundle dataBundle){ unsubscribe(profileName, topicFilter, null, null); } - private boolean ProcessQueryServiceAction(){ + private void ProcessQueryServiceAction(){ Log.d(TAG, "Query Service Action received"); Bundle resultBundle = new Bundle(); resultBundle.putString(MqttServiceConstants.CALLBACK_ACTION, TaskerMqttConstants.QUERY_SERVICE_RUNNING_ACTION); if(this.mServiceStarted) { this.callbackToActivity(null, Status.OK, resultBundle); - return true; } else{ this.callbackToActivity(null, Status.ERROR, resultBundle); - return false; + stopForeground(true); + stopSelf(); } }