deeke-script-app 1.7.8 → 1.8.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.
|
@@ -136,6 +136,39 @@ interface access {
|
|
|
136
136
|
* @return true 如果权限被永久拒绝或禁用
|
|
137
137
|
*/
|
|
138
138
|
public isStoragePermissionPermanentlyDenied(): boolean;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* 检查是否有位置权限
|
|
142
|
+
*
|
|
143
|
+
* 权限说明:
|
|
144
|
+
* - 检查 ACCESS_FINE_LOCATION(精确定位)或 ACCESS_COARSE_LOCATION(粗略定位)权限
|
|
145
|
+
* - 如果授予了 ACCESS_FINE_LOCATION,则自动拥有 ACCESS_COARSE_LOCATION 权限
|
|
146
|
+
*
|
|
147
|
+
* @return true 如果有权限
|
|
148
|
+
*/
|
|
149
|
+
public hasLocationPermission(): boolean;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* 申请位置权限
|
|
153
|
+
*
|
|
154
|
+
* 权限说明:
|
|
155
|
+
* - 优先请求 ACCESS_FINE_LOCATION(精确定位)
|
|
156
|
+
* - 如果用户拒绝了精确定位,系统可能降级为 ACCESS_COARSE_LOCATION(粗略定位)
|
|
157
|
+
*
|
|
158
|
+
* 注意:这是异步操作,不会阻塞
|
|
159
|
+
* 如果用户禁用了权限,需要调用 isLocationPermissionPermanentlyDenied() 检查是否被永久拒绝
|
|
160
|
+
*/
|
|
161
|
+
public requestLocationPermissions(): void;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* 检查位置权限是否被永久拒绝(用户选择了"不再询问")
|
|
165
|
+
*
|
|
166
|
+
* 如果返回true,说明用户之前拒绝过权限并选择了"不再询问",
|
|
167
|
+
* 系统不会再弹出权限对话框,需要引导用户去设置页面手动开启
|
|
168
|
+
*
|
|
169
|
+
* @return true 如果权限被永久拒绝
|
|
170
|
+
*/
|
|
171
|
+
public isLocationPermissionPermanentlyDenied(): boolean;
|
|
139
172
|
}
|
|
140
173
|
|
|
141
174
|
export { };
|
|
@@ -28,13 +28,11 @@ interface Device {
|
|
|
28
28
|
*/
|
|
29
29
|
public androidVersion(): string;
|
|
30
30
|
|
|
31
|
-
/**
|
|
32
|
-
* 生成设备唯一标识符, 卸载App前,可以通过getUuid获取,卸载后丢失
|
|
33
|
-
*/
|
|
34
|
-
public createUuid(): string;
|
|
35
|
-
|
|
36
31
|
/**
|
|
37
32
|
* 获取设备唯一标识符
|
|
33
|
+
*
|
|
34
|
+
* 返回系统级别的 ANDROID_ID,在设备恢复出厂设置之前会保持不变,保证设备唯一性。
|
|
35
|
+
* 注意:设备恢复出厂设置后,ANDROID_ID 可能会改变。App卸载不会影响此标识符。
|
|
38
36
|
*/
|
|
39
37
|
public getUuid(): string;
|
|
40
38
|
|
|
@@ -207,6 +205,27 @@ interface Device {
|
|
|
207
205
|
publicIP: string;
|
|
208
206
|
publicIPV6: string;
|
|
209
207
|
};
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* 获取设备当前位置信息
|
|
211
|
+
*
|
|
212
|
+
* 需要先申请位置权限(使用Access.requestLocationPermissions())。
|
|
213
|
+
* 此方法会优先使用GPS定位(更精确),如果GPS不可用,会尝试使用网络定位。
|
|
214
|
+
* 如果仍然无法获取位置,会尝试使用被动定位提供者。
|
|
215
|
+
*
|
|
216
|
+
* @returns 位置信息对象,包含纬度、经度、海拔、精度、速度、方向角、时间戳和定位提供者。
|
|
217
|
+
* 如果获取失败或没有权限,返回 null
|
|
218
|
+
*/
|
|
219
|
+
public getLocation(): {
|
|
220
|
+
latitude: number;
|
|
221
|
+
longitude: number;
|
|
222
|
+
altitude: number;
|
|
223
|
+
accuracy: number;
|
|
224
|
+
speed: number;
|
|
225
|
+
bearing: number;
|
|
226
|
+
time: number;
|
|
227
|
+
provider: string;
|
|
228
|
+
} | null;
|
|
210
229
|
}
|
|
211
230
|
|
|
212
231
|
export { };
|
|
@@ -9,6 +9,18 @@ interface System {
|
|
|
9
9
|
*/
|
|
10
10
|
public sleep(milliSecond: number): void;
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* 精确休眠
|
|
14
|
+
* @param milliSecond 毫秒
|
|
15
|
+
*
|
|
16
|
+
* 与sleep()方法相比,preciseSleep()使用更精确的休眠机制,
|
|
17
|
+
* 通过WakeLock保持CPU唤醒状态,并使用循环检查来确保休眠时间的准确性。
|
|
18
|
+
*
|
|
19
|
+
* 注意:此方法会保持CPU唤醒状态,可能会增加电量消耗。
|
|
20
|
+
* 如果不需要精确的休眠时间,建议使用sleep()方法。
|
|
21
|
+
*/
|
|
22
|
+
public preciseSleep(milliSecond: number): void;
|
|
23
|
+
|
|
12
24
|
/**
|
|
13
25
|
* 释放内存
|
|
14
26
|
*/
|