diff --git a/README.md b/README.md index ff9505d6..fc7b30a2 100644 --- a/README.md +++ b/README.md @@ -337,12 +337,13 @@ Configure options: | `fastestInterval` | `Number` | Android | Fastest rate in milliseconds at which your app can handle location updates. **@see** [Android docs](https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.html#getFastestInterval()). | ACT | 120000 | | `activitiesInterval` | `Number` | Android | Rate in milliseconds at which activity recognition occurs. Larger values will result in fewer activity detections while improving battery life. | ACT | 10000 | | `stopOnStillActivity` | `Boolean` | Android | @deprecated stop location updates, when the STILL activity is detected | ACT | true | -| `startForeground` | `Boolean` | Android | show service notification when in foreground | all | false | -| `notificationTitle` | `String` optional | Android | Custom notification title in the drawer. | all | "Background tracking" | -| `notificationText` | `String` optional | Android | Custom notification text in the drawer. | all | "ENABLED" | -| `notificationIconColor` | `String` optional | Android | The accent color to use for notification. Eg. **#4CAF50**. | all | | -| `notificationIconLarge` | `String` optional | Android | The filename of a custom notification icon. **@see** Android quirks. | all | | -| `notificationIconSmall` | `String` optional | Android | The filename of a custom notification icon. **@see** Android quirks. | all | | +| `notificationsEnabled` | `Boolean` | Android | Enable/disable local notifications when tracking and syncing locations | all | true | +| `startForeground` | `Boolean` | Android | Allow location sync service to run in foreground state. Foreground state also requires a notification to be presented to the user. | all | false | +| `notificationTitle` | `String` optional | Android | Custom notification title in the drawer. (goes with `startForeground`) | all | "Background tracking" | +| `notificationText` | `String` optional | Android | Custom notification text in the drawer. (goes with `startForeground`) | all | "ENABLED" | +| `notificationIconColor` | `String` optional | Android | The accent color to use for notification. Eg. **#4CAF50**. (goes with `startForeground`) | all | | +| `notificationIconLarge` | `String` optional | Android | The filename of a custom notification icon. **@see** Android quirks. (goes with `startForeground`) | all | | +| `notificationIconSmall` | `String` optional | Android | The filename of a custom notification icon. **@see** Android quirks. (goes with `startForeground`) | all | | | `activityType` | `String` | iOS | [AutomotiveNavigation, OtherNavigation, Fitness, Other] Presumably, this affects iOS GPS algorithm. **@see** [Apple docs](https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html#//apple_ref/occ/instp/CLLocationManager/activityType) for more information | all | "OtherNavigation" | | `pauseLocationUpdates` | `Boolean` | iOS | Pauses location updates when app is paused. **@see* [Apple docs](https://developer.apple.com/documentation/corelocation/cllocationmanager/1620553-pauseslocationupdatesautomatical?language=objc) | all | false | | `saveBatteryOnBackground` | `Boolean` | iOS | Switch to less accurate significant changes and region monitory when in background | all | false | diff --git a/android/lib/src/main/java/com/marianhello/bgloc/react/ConfigMapper.java b/android/lib/src/main/java/com/marianhello/bgloc/react/ConfigMapper.java index ca9c5721..c238a98f 100644 --- a/android/lib/src/main/java/com/marianhello/bgloc/react/ConfigMapper.java +++ b/android/lib/src/main/java/com/marianhello/bgloc/react/ConfigMapper.java @@ -49,6 +49,7 @@ public static Config fromMap(ReadableMap options) throws JSONException { if (options.hasKey("stopOnTerminate")) config.setStopOnTerminate(options.getBoolean("stopOnTerminate")); if (options.hasKey("startOnBoot")) config.setStartOnBoot(options.getBoolean("startOnBoot")); if (options.hasKey("startForeground")) config.setStartForeground(options.getBoolean("startForeground")); + if (options.hasKey("notificationsEnabled")) config.setNotificationsEnabled(options.getBoolean("notificationsEnabled")); if (options.hasKey("locationProvider")) config.setLocationProvider(options.getInt("locationProvider")); if (options.hasKey("interval")) config.setInterval(options.getInt("interval")); if (options.hasKey("fastestInterval")) config.setFastestInterval(options.getInt("fastestInterval")); @@ -149,6 +150,9 @@ public static ReadableMap toMap(Config config) { if (config.getStartForeground() != null) { out.putBoolean("startForeground", config.getStartForeground()); } + if (config.getNotificationsEnabled() != null) { + out.putBoolean("notificationsEnabled", config.getNotificationsEnabled()); + } if (config.getLocationProvider() != null) { out.putInt("locationProvider", config.getLocationProvider()); }