Skip to content

Commit 5c99187

Browse files
committed
chore!(geolocation): migrate to @nativescript/geolocation
1 parent 3b8da30 commit 5c99187

File tree

7 files changed

+11193
-666
lines changed

7 files changed

+11193
-666
lines changed

README.md

+23-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ What we plan to offer in the future:
2222

2323
### Android only
2424

25+
#### Google Play Services conflicts
26+
2527
Given that we rely on [nativescript-geolocation](https://github.com/NativeScript/nativescript-geolocation) and use Google Play Services APIs for activity detection on Android devices, you might find Google Play Services version conflicts with other installed plugins.
2628

2729
In order to avoid them, we advise you to force a specific Google Play Services version. For a better human activity detection functionality, version 17 or above is highly recommended. In order to do so, please, indicate the Google Play Services Version number in your `app/App_Resources/Android/before-plugins.gradle` file (if the file does not exist, just create it):
@@ -36,6 +38,26 @@ android {
3638
}
3739
```
3840

41+
#### Permissions
42+
43+
In order to use geolocation on Android, you'll need to add the following permission(s) to your app's `AndroidManifest.xml` inside the `App_Resources/Android/src/main` dir:
44+
45+
```xml
46+
<!-- Always include this permission -->
47+
<!-- This permission is for "approximate" location data -->
48+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
49+
50+
<!-- Include only if your app benefits from precise location access. -->
51+
<!-- This permission is for "precise" location data -->
52+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
53+
54+
<!-- Required only when requesting background location access on
55+
Android 10 (API level 29) and higher. -->
56+
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
57+
```
58+
59+
More information can be found in the [Android docs here](https://developer.android.com/training/location/permissions).
60+
3961
> Source: [https://github.com/NativeScript/nativescript-geolocation](https://github.com/NativeScript/nativescript-geolocation)
4062
4163
## Installation
@@ -45,7 +67,7 @@ Run the following command in your project's root folder.
4567
NS7+:
4668

4769
```javascript
48-
tns plugin add nativescript-context-apis
70+
ns plugin add nativescript-context-apis
4971
```
5072

5173
NS6:

demo/app/App_Resources/Android/src/main/AndroidManifest.xml

+12
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@
1010
android:largeScreens="true"
1111
android:xlargeScreens="true"/>
1212

13+
<!-- Always include this permission -->
14+
<!-- This permission is for "approximate" location data -->
15+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
16+
17+
<!-- Include only if your app benefits from precise location access. -->
18+
<!-- This permission is for "precise" location data -->
19+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
20+
21+
<!-- Required only when requesting background location access on
22+
Android 10 (API level 29) and higher. -->
23+
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
24+
1325
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
1426
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
1527
<uses-permission android:name="android.permission.INTERNET"/>

0 commit comments

Comments
 (0)