Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure mService exists when we call start or stop #17

Merged
merged 3 commits into from
Sep 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -410,13 +410,17 @@ public BackgroundLocation getCurrentLocation(int timeout, long maximumAge, boole

public void switchMode(final int mode) {
synchronized (mLock) {
mService.executeProviderCommand(LocationProvider.CMD_SWITCH_MODE, mode);
if (mService != null) {
mService.executeProviderCommand(LocationProvider.CMD_SWITCH_MODE, mode);
}
}
}

public void sendCommand(final int commandId) {
synchronized (mLock) {
mService.executeProviderCommand(commandId, 0);
if (mService != null) {
mService.executeProviderCommand(commandId, 0);
}
}
}

Expand Down Expand Up @@ -519,14 +523,18 @@ public void registerHeadlessTask(final String jsFunction) {
private void startBackgroundService() {
logger.info("Attempt to start bg service");
synchronized (mLock) {
mService.start();
if (mService != null) {
mService.start();
}
}
}

private void stopBackgroundService() {
logger.info("Attempt to stop bg service");
synchronized (mLock) {
mService.stop();
if (mService != null) {
mService.stop();
}
}
}

Expand Down