@tauri-apps/plugin-geolocation 2.0.0-rc.2 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,9 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
This plugin provides APIs for getting and tracking the device's current position, including information about altitude, heading, and speed (if available).
|
|
4
4
|
|
|
5
|
+
| Platform | Supported |
|
|
6
|
+
| -------- | --------- |
|
|
7
|
+
| Linux | x |
|
|
8
|
+
| Windows | x |
|
|
9
|
+
| macOS | x |
|
|
10
|
+
| Android | ✓ |
|
|
11
|
+
| iOS | ✓ |
|
|
12
|
+
|
|
5
13
|
## Install
|
|
6
14
|
|
|
7
|
-
_This plugin requires a Rust version of at least **1.
|
|
15
|
+
_This plugin requires a Rust version of at least **1.77.2**_
|
|
8
16
|
|
|
9
17
|
There are three general methods of installation that we can recommend.
|
|
10
18
|
|
|
@@ -18,7 +26,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
|
|
|
18
26
|
|
|
19
27
|
```toml
|
|
20
28
|
[dependencies]
|
|
21
|
-
tauri-plugin-geolocation = "2.0.0
|
|
29
|
+
tauri-plugin-geolocation = "2.0.0"
|
|
22
30
|
# alternatively with Git:
|
|
23
31
|
tauri-plugin-geolocation = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
|
24
32
|
```
|
|
@@ -73,7 +81,7 @@ The Google Play Store uses this property to decide whether it should show the ap
|
|
|
73
81
|
|
|
74
82
|
First you need to register the core plugin with Tauri:
|
|
75
83
|
|
|
76
|
-
`src-tauri/src/
|
|
84
|
+
`src-tauri/src/lib.rs`
|
|
77
85
|
|
|
78
86
|
```rust
|
|
79
87
|
fn main() {
|
|
@@ -84,6 +92,20 @@ fn main() {
|
|
|
84
92
|
}
|
|
85
93
|
```
|
|
86
94
|
|
|
95
|
+
Then, for instance, grant the plugin the permission to check or request permissions from the user and to read the device position
|
|
96
|
+
|
|
97
|
+
`src-tauri/capabilities/default.json`
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
"permissions": [
|
|
101
|
+
"core:default",
|
|
102
|
+
"geolocation:allow-check-permissions",
|
|
103
|
+
"geolocation:allow-request-permissions",
|
|
104
|
+
"geolocation:allow-get-current-position",
|
|
105
|
+
"geolocation:allow-watch-position",
|
|
106
|
+
]
|
|
107
|
+
```
|
|
108
|
+
|
|
87
109
|
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
|
88
110
|
|
|
89
111
|
```javascript
|
|
@@ -92,7 +114,7 @@ import {
|
|
|
92
114
|
requestPermissions,
|
|
93
115
|
getCurrentPosition,
|
|
94
116
|
watchPosition
|
|
95
|
-
} from '@tauri-apps/plugin-
|
|
117
|
+
} from '@tauri-apps/plugin-geolocation'
|
|
96
118
|
|
|
97
119
|
let permissions = await checkPermissions()
|
|
98
120
|
if (
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tauri-apps/plugin-geolocation",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"license": "MIT
|
|
3
|
+
"version": "2.2.0",
|
|
4
|
+
"license": "MIT OR Apache-2.0",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Tauri Programme within The Commons Conservancy"
|
|
7
7
|
],
|
|
@@ -24,6 +24,6 @@
|
|
|
24
24
|
"LICENSE"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@tauri-apps/api": "^2.0.0
|
|
27
|
+
"@tauri-apps/api": "^2.0.0"
|
|
28
28
|
}
|
|
29
29
|
}
|