1
- # react-native-location-settings- enabler
1
+ # react-native-location-enabler
2
2
3
- [ ![ GitHub version] ( https://badge.fury.io/gh/YsnKsy%2Freact-native-location-settings- enabler.svg )] ( https://github.com/YsnKsy/react-native-location-settings -enabler )
4
- [ ![ npm version] ( https://badge.fury.io/js/react-native-location-settings- enabler.svg )] ( https://www.npmjs.com/package/react-native-location-settings -enabler/ )
5
- ![ Last Release] ( https://github.com/YsnKsy/react-native-location-settings- enabler/workflows/Release/badge.svg )
6
- ![ Pull Request] ( https://github.com/YsnKsy/react-native-location-settings- enabler/workflows/Pull%20Request/badge.svg )
7
- [ ![ GitHub issues] ( https://img.shields.io/github/issues/YsnKsy/react-native-location-settings- enabler )] ( https://github.com/YsnKsy/react-native-location-settings -enabler/issues )
8
- [ ![ PRs Welcome] ( https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square )] ( https://github.com/YsnKsy/react-native-location-settings- enabler/blob/master/CONTRIBUTING.md )
3
+ [ ![ GitHub version] ( https://badge.fury.io/gh/YsnKsy%2Freact-native-location-enabler.svg )] ( https://github.com/YsnKsy/react-native-location-enabler )
4
+ [ ![ npm version] ( https://badge.fury.io/js/react-native-location-enabler.svg )] ( https://www.npmjs.com/package/react-native-location-enabler/ )
5
+ ![ Last Release] ( https://github.com/YsnKsy/react-native-location-enabler/workflows/Release/badge.svg )
6
+ ![ Pull Request] ( https://github.com/YsnKsy/react-native-location-enabler/workflows/Pull%20Request/badge.svg )
7
+ [ ![ GitHub issues] ( https://img.shields.io/github/issues/YsnKsy/react-native-location-enabler )] ( https://github.com/YsnKsy/react-native-location-enabler/issues )
8
+ [ ![ PRs Welcome] ( https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square )] ( https://github.com/YsnKsy/react-native-location-enabler/blob/master/CONTRIBUTING.md )
9
9
10
10
![ Platform - Android] ( https://img.shields.io/badge/platform-Android-green.svg )
11
11
[ ![ styled with Prettier] ( https://img.shields.io/badge/styled_with-Prettier-ff69b4.svg )] ( https://github.com/prettier/prettier )
12
12
[ ![ semantic-release] ( https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg )] ( https://github.com/semantic-release/semantic-release )
13
- [ ![ GitHub license] ( https://img.shields.io/github/license/YsnKsy/react-native-location-settings- enabler )] ( https://github.com/YsnKsy/react-native-location-settings -enabler/blob/master/LICENSE )
13
+ [ ![ GitHub license] ( https://img.shields.io/github/license/YsnKsy/react-native-location-enabler )] ( https://github.com/YsnKsy/react-native-location-enabler/blob/master/LICENSE )
14
14
15
15
This package makes it easy for an React Native App to ensure that the Android device' ; s system settings are properly configured for the app' ; s location needs. If your app needs to request location, the device needs to enable the appropriate system settings, such as GPS or Wi-Fi scanning. Rather than directly enabling services such as the device' ; s GPS, your app specifies the required level of accuracy/power consumption, and the device automatically makes the appropriate changes to system settings.
16
16
@@ -21,7 +21,7 @@ This package makes it easy for an React Native App to ensure that the Android de
21
21
## Installation
22
22
23
23
``` sh
24
- yarn add react-native-location-settings- enabler
24
+ yarn add react-native-location-enabler
25
25
```
26
26
27
27
---
@@ -31,12 +31,12 @@ yarn add react-native-location-settings-enabler
31
31
### Example using Hook (React Hooks API) :
32
32
33
33
``` js
34
- import LocationSettingsEnabler from " react-native-location-settings -enabler"
34
+ import LocationEnabler from " react-native-location-enabler"
35
35
36
36
const {
37
37
PRIORITIES: { HIGH_ACCURACY },
38
38
useLocationSettings ,
39
- } = LocationSettingsEnabler
39
+ } = LocationEnabler
40
40
41
41
// React Component
42
42
const App = () => {
@@ -64,14 +64,14 @@ const App = () => {
64
64
### Example using Listener :
65
65
66
66
``` js
67
- import LocationSettingsEnabler from " react-native-location-settings -enabler"
67
+ import LocationEnabler from " react-native-location-enabler"
68
68
69
69
const {
70
70
PRIORITIES: { HIGH_ACCURACY },
71
71
addListener ,
72
72
checkSettings ,
73
73
requestResolutionSettings
74
- } = LocationSettingsEnabler
74
+ } = LocationEnabler
75
75
76
76
// Adds a listener to be invoked when location settings checked using
77
77
// [checkSettings] or changed using [requestResolutionSettings]
@@ -104,7 +104,7 @@ listener.remove();
104
104
Clone the repo
105
105
106
106
``` sh
107
- git clone https://github.com/YsnKsy/react-native-location-settings- enabler.git && cd react-native-location-settings -enabler
107
+ git clone https://github.com/YsnKsy/react-native-location-enabler.git && cd react-native-location-enabler
108
108
```
109
109
110
110
Install npm dependencies
@@ -138,14 +138,9 @@ yarn example android
138
138
> ` PRIORITIES `
139
139
140
140
``` js
141
- import LocationSettingsEnabler from " react-native-location-settings -enabler"
141
+ import LocationEnabler from " react-native-location-enabler"
142
142
143
- const {
144
- HIGH_ACCURACY ,
145
- BALANCED_POWER_ACCURACY ,
146
- LOW_POWER ,
147
- NO_POWER ,
148
- } = LocationSettingsEnabler .PRIORITIES
143
+ const { HIGH_ACCURACY , BALANCED_POWER_ACCURACY , LOW_POWER , NO_POWER } = LocationEnabler .PRIORITIES
149
144
```
150
145
151
146
Static object contain a list quality of service for location updates. If your application wants high accuracy location it should set prioprity to 'HIGH_ACCURACY'. If you want negligible power impact, but to still receive location updates when available, then set priority to 'NO_POWER'.
@@ -157,12 +152,12 @@ Static object contain a list quality of service for location updates. If your ap
157
152
> ### ` useLocationSettings({ priority, alwaysShow, needBle }, initialStatus?) `
158
153
159
154
``` js
160
- import LocationSettingsEnabler from " react-native-location-settings -enabler"
155
+ import LocationEnabler from " react-native-location-enabler"
161
156
162
157
const {
163
158
useLocationSettings ,
164
159
PRIORITIES: { HIGH_ACCURACY },
165
- } = LocationSettingsEnabler
160
+ } = LocationEnabler
166
161
167
162
const [enabled , requestResolution ] = useLocationSettings ({
168
163
priority: HIGH_ACCURACY , // optional: default BALANCED_POWER_ACCURACY
@@ -185,12 +180,12 @@ Hook let you check the user's device location status 'on' / 'off' and method let
185
180
> ### ` checkSettings({ priority, alwaysShow, needBle }) `
186
181
187
182
``` js
188
- import LocationSettingsEnabler from " react-native-location-settings -enabler"
183
+ import LocationEnabler from " react-native-location-enabler"
189
184
190
185
const {
191
186
checkSettings ,
192
187
PRIORITIES: { HIGH_ACCURACY },
193
- } = LocationSettingsEnabler
188
+ } = LocationEnabler
194
189
195
190
checkSettings ({
196
191
priority: HIGH_ACCURACY , // optional: default BALANCED_POWER_ACCURACY
@@ -206,12 +201,12 @@ Checking if the user's device location is turned on / off.
206
201
> ### ` requestResolutionSettings({ priority, alwaysShow, needBle }) `
207
202
208
203
``` js
209
- import LocationSettingsEnabler from " react-native-location-settings -enabler"
204
+ import LocationEnabler from " react-native-location-enabler"
210
205
211
206
const {
212
207
requestResolutionSettings ,
213
208
PRIORITIES: { HIGH_ACCURACY },
214
- } = LocationSettingsEnabler
209
+ } = LocationEnabler
215
210
216
211
requestResolutionSettings ({
217
212
priority: HIGH_ACCURACY , // optional: default BALANCED_POWER_ACCURACY
@@ -227,7 +222,7 @@ Display an activity where they can turn location 'on' using a location request.
227
222
> ### ` addListener(callback, context?) `
228
223
229
224
``` js
230
- import LocationSettingsEnabler from " react-native-location-settings -enabler"
225
+ import LocationEnabler from " react-native-location-enabler"
231
226
232
227
let listener = null
233
228
@@ -242,7 +237,7 @@ function cb(result) {
242
237
}
243
238
}
244
239
245
- listener = LocationSettingsEnabler .addListener (cb)
240
+ listener = LocationEnabler .addListener (cb)
246
241
```
247
242
248
243
Adds a listener to be invoked when onChangeLocationSettings are emitted. An optional calling context may be provided. The data arguments emitted will be passed to the listener function.
0 commit comments