You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clarify permissions requirements earlier in the documentation (#226)
* Improve documentation
* Fix typos
* Improve explanation
* Add note for applying permission to info.plist
* Change flutter package get to flutter pub get
* Add placeholder and caution to add description in ios config
* Fix some typo
<string>[Describe your purpose for using this permission]</string>
33
+
<key>NSLocationAlwaysUsageDescription</key>
34
+
<string>[Describe your purpose for using this permission]</string>
35
+
<key>NSLocationWhenInUseUsageDescription</key>
36
+
<string>[Describe your purpose for using this permission]</string>
37
+
<key>UIBackgroundModes</key>
38
+
<array>
39
+
<string>fetch</string>
40
+
<string>location</string>
41
+
</array>
42
+
```
43
+
44
+
> *Note*: You need to describe your purpose for using the permission in to `string` value. If not, attempts to access the resource fail, and might even cause your app to crash. And when publishing to the App Store, this can cause your app to be rejected by Apple. Refer to [Provide a purpose string (Apple Docummentation)](https://developer.apple.com/documentation/uikit/protecting_the_user_s_privacy/requesting_access_to_protected_resources#3037322).
45
+
46
+
### Android Platform Permission
47
+
48
+
In `android/app/src/main/AndroidManifest.xml` add:
Request permissions from the user. You can use [permission_handler](https://pub.dev/packages/permission_handler) for this
66
+
Request permissions from the user. You can use [permission_handler](https://pub.dev/packages/permission_handler) for this.
31
67
32
-
Set the notification title, message and icon **(Android only)**. Use `await` or `.then` if you wanna start the location service immediatly after becuase its an asynchronous method
68
+
Set the notification title, message and icon **(Android only)**. Use `await` or `.then` if you wanna start the location service immediately after because it's an asynchronous method
33
69
34
70
```dart
35
71
BackgroundLocation.setAndroidNotification(
36
-
title: "Notification title",
37
-
message: "Notification message",
38
-
icon: "@mipmap/ic_launcher",
72
+
title: "Notification title",
73
+
message: "Notification message",
74
+
icon: "@mipmap/ic_launcher",
39
75
);
40
76
```
41
77
42
-
Set the interval between localisations in milliseconds **(Android only)**. Use `await` or `.then` if you wanna start the location service immediatly after becuase its an asynchronous method
78
+
Set the interval between localizations in milliseconds **(Android only)**. Use `await` or `.then` if you wanna start the location service immediately after because it's an asynchronous method
Start the location service. This will also ask the user for permission if not asked previously by another package.
49
85
50
86
```dart
51
-
BackgroundLocation.stopLocationService(); //To ensure that previously started services have been stopped, if desired
87
+
// To ensure that previously started services have been stopped, if desired
88
+
BackgroundLocation.stopLocationService();
89
+
90
+
// Then start the service
52
91
BackgroundLocation.startLocationService();
53
92
```
54
93
55
94
> *Note:* There is currently an open issue (#10) where, if the location service is started multiple times, the location callback will get called repeatedly. This can be worked around by calling BackgroundLocation.stopLocationService(); to stop any previous running services (such as from a previous run of the app) before starting a new one.
56
95
57
-
58
96
Start location service by specifying `distanceFilter`. Defaults to `0` if not specified
59
97
60
98
```dart
@@ -67,7 +105,7 @@ You can also force the use of Android `LocationManager` instead of Google's `Fus
`getLocationUpdates` will trigger everytime the location updates on the device. Provide a callback function to `getLocationUpdates` to handle location update.
108
+
`getLocationUpdates` will triggered whenever the location is updated on the device. Provide a callback function to `getLocationUpdates` to handle location updates.
0 commit comments