@tauri-apps/plugin-geolocation 2.0.0 → 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 +17 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ This plugin provides APIs for getting and tracking the device's current position
|
|
|
12
12
|
|
|
13
13
|
## Install
|
|
14
14
|
|
|
15
|
-
_This plugin requires a Rust version of at least **1.
|
|
15
|
+
_This plugin requires a Rust version of at least **1.77.2**_
|
|
16
16
|
|
|
17
17
|
There are three general methods of installation that we can recommend.
|
|
18
18
|
|
|
@@ -81,7 +81,7 @@ The Google Play Store uses this property to decide whether it should show the ap
|
|
|
81
81
|
|
|
82
82
|
First you need to register the core plugin with Tauri:
|
|
83
83
|
|
|
84
|
-
`src-tauri/src/
|
|
84
|
+
`src-tauri/src/lib.rs`
|
|
85
85
|
|
|
86
86
|
```rust
|
|
87
87
|
fn main() {
|
|
@@ -92,6 +92,20 @@ fn main() {
|
|
|
92
92
|
}
|
|
93
93
|
```
|
|
94
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
|
+
|
|
95
109
|
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
|
96
110
|
|
|
97
111
|
```javascript
|
|
@@ -100,7 +114,7 @@ import {
|
|
|
100
114
|
requestPermissions,
|
|
101
115
|
getCurrentPosition,
|
|
102
116
|
watchPosition
|
|
103
|
-
} from '@tauri-apps/plugin-
|
|
117
|
+
} from '@tauri-apps/plugin-geolocation'
|
|
104
118
|
|
|
105
119
|
let permissions = await checkPermissions()
|
|
106
120
|
if (
|