@capacitor-community/background-geolocation
Advanced tools
Comparing version 0.3.10 to 0.3.11
{ | ||
"name": "@capacitor-community/background-geolocation", | ||
"version": "0.3.10", | ||
"version": "0.3.11", | ||
"description": "Receive geolocation updates even while app is backgrounded.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -11,11 +11,21 @@ # Background Geolocation | ||
const id = BackgroundGeolocation.addWatcher( | ||
// To start listening for changes in the device's location, add a new watcher. | ||
// You do this by calling 'addWatcher' with an options object and a callback. An | ||
// ID is returned, which can be used to remove the watcher in the future. The | ||
// callback will be called every time a new location is available. Watchers can | ||
// not be paused, only removed. Multiple watchers may exist at the same time. | ||
const watcher_id = BackgroundGeolocation.addWatcher( | ||
{ | ||
// On Android, the plugin shows a notification which allows it to | ||
// continue receiving location updates in the background. If this option | ||
// is undefined, the notification is not delivered and hence background | ||
// location updates are not guaranteed. | ||
// If the "backgroundMessage" option is defined, the watcher will | ||
// provide location updates whether the app is in the background or the | ||
// foreground. If it is not defined, location updates are only | ||
// guaranteed in the foreground. This is true on both platforms. | ||
// On Android, a notification must be shown to continue receiving | ||
// location updates in the background. This option specifies the text of | ||
// that notification. | ||
backgroundMessage: "Cancel to prevent battery drain.", | ||
// The title for the notification. Defaults to "Using your location". | ||
// The title of the notification mentioned above. Defaults to "Using | ||
// your location". | ||
backgroundTitle: "Tracking You.", | ||
@@ -49,2 +59,6 @@ | ||
if (value) { | ||
// It can be useful to direct the user to their device's | ||
// settings when location permissions have been denied. | ||
// The plugin provides 'openSettings' to do exactly | ||
// this. | ||
BackgroundGeolocation.openSettings(); | ||
@@ -61,4 +75,7 @@ } | ||
// Some time later. | ||
BackgroundGeolocation.removeWatcher({id}); | ||
// When a watcher is no longer needed, it should be removed by calling | ||
// 'removeWatcher' with an object containing its ID. | ||
BackgroundGeolocation.removeWatcher({ | ||
id: watcher_id | ||
}); | ||
@@ -178,1 +195,24 @@ // The location object. | ||
``` | ||
Configration specific to Android can be made in `strings.xml`: | ||
```xml | ||
<resources> | ||
<!-- | ||
The channel name for the background notification. This will be visible | ||
when the user presses & holds the notification. It defaults to | ||
"Background Tracking". | ||
--> | ||
<string name="capacitor_background_geolocation_notification_channel_name"> | ||
Background Tracking | ||
</string> | ||
<!-- | ||
The icon to use for the background notification. Note the absence of a | ||
leading "@". It defaults to "mipmap/ic_launcher", the app's launch icon. | ||
--> | ||
<string name="capacitor_background_geolocation_notification_icon"> | ||
drawable/ic_tracking | ||
</string> | ||
</resources> | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42930
215