diff --git a/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceImpl.java b/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceImpl.java index a63a3ef2..28e46bc9 100644 --- a/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceImpl.java +++ b/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceImpl.java @@ -417,8 +417,13 @@ public void startForeground() { mProvider.onCommand(LocationProvider.CMD_SWITCH_MODE, LocationProvider.FOREGROUND_MODE); } - super.startForeground(NOTIFICATION_ID, notification); - mIsInForeground = true; + try{ + super.startForeground(NOTIFICATION_ID, notification); + mIsInForeground = true; + }catch(Exception e){ + mIsInForeground = false; + logger.error("startForeground: exception", e); + } } }