Skip to content

Commit

Permalink
Stop the service and then shutdown freenet
Browse files Browse the repository at this point in the history
  • Loading branch information
desyncr committed Jul 14, 2020
1 parent 8c71c48 commit 49c15ce
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,21 +132,19 @@ private int startNode() {
* @return
*/
public int stopService(Context context) {
status.postValue(Status.STOPPING);
Intent serviceIntent = new Intent(context, Service.class);
context.stopService(serviceIntent);

// Flagging the status as Stopped as it kills the app instantly
status.postValue(Status.STOPPED);
try {
if (runner.stop() == 0) {
status.postValue(Status.STOPPED);
} else {
if (runner.stop() != 0) {
status.postValue(Status.ERROR);

}
} catch (Exception e) {
status.postValue(Status.ERROR);
}

Intent serviceIntent = new Intent(context, Service.class);
context.stopService(serviceIntent);

return 0;
}

Expand Down

0 comments on commit 49c15ce

Please sign in to comment.