This commit is contained in:
Victor Shcherb 2016-04-16 22:10:39 +02:00
parent 0570e87207
commit e8fc3aa8a1

View file

@ -729,11 +729,15 @@ public class OsmandApplication extends MultiDexApplication {
public void startNavigationService(int intent, int interval) { public void startNavigationService(int intent, int interval) {
final Intent serviceIntent = new Intent(this, NavigationService.class); final Intent serviceIntent = new Intent(this, NavigationService.class);
if (getNavigationService() != null) {
intent |= getNavigationService().getUsedBy();
interval = Math.min(getNavigationService().getServiceOffInterval(), interval);
getNavigationService().stopSelf();
}
serviceIntent.putExtra(NavigationService.USAGE_INTENT, intent); serviceIntent.putExtra(NavigationService.USAGE_INTENT, intent);
serviceIntent.putExtra(NavigationService.USAGE_OFF_INTERVAL, interval); serviceIntent.putExtra(NavigationService.USAGE_OFF_INTERVAL, interval);
if (getNavigationService() != null) {
getNavigationService().stopSelf();
}
startService(serviceIntent); startService(serviceIntent);
getNotificationHelper().showNotification(); getNotificationHelper().showNotification();
} }