Skip to content

Commit

Permalink
Re-worked fix for incorrectly respawning background process
Browse files Browse the repository at this point in the history
  • Loading branch information
jstys committed May 16, 2017
1 parent 894c248 commit 24407e8
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
}

Expand Down

0 comments on commit 24407e8

Please sign in to comment.