TencentLocationSDK class abstract
腾讯定位 SDK 的全局入口。所有全局设置都在此类。
使用顺序:
- setPrivacyPolicyAgreement(true) — 同意隐私政策
- init(...) — 设置 API Key(也可在 manifest/plist 中配置)
- 创建 TencentLocationManager / TencentGeofenceManager 实例使用
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
onSdkLogChanged
→ Stream<
TencentSdkLogEvent> -
订阅 SDK 运行日志。
no setter
Static Methods
-
enableLogToFile(
bool enabled) → Future< void> - 是否把 SDK 日志写入本地文件。建议开发调试时打开,生产环境关闭。
-
getBuildVersion(
) → Future< String> - 获取 SDK 构建版本号。
-
getIosAccuracyAuthorization(
) → Future< IosAccuracyAuthorization> - 获取当前系统精度权限状态(iOS 14+)。
-
getOaid(
) → Future< String> - 获取设备 OAID(Android 设备唯一标识)。
-
getPrivacyPolicyAgreement(
) → Future< bool> - 获取当前隐私政策同意状态。
-
getVersion(
) → Future< String> - 获取 SDK 版本号。
-
init(
{String? androidApiKey, String? iosApiKey, String? harmonyApiKey, String? deviceId, String? extraKey}) → Future< void> - 初始化 SDK。调用前必须已同意隐私政策。
-
requestIosAlwaysAuthorization(
) → Future< void> - 请求始终允许定位权限。
-
requestIosTemporaryFullAccuracy(
{required String purposeKey}) → Future< String?> - 请求临时的完全精度权限(iOS 14+)。
-
requestIosWhenInUseAuthorization(
) → Future< void> - 请求使用期间定位权限。
-
setExtraData(
String key, String value) → Future< void> - 设置 SDK 附加数据。
-
setLoadLibraryEnabled(
bool enabled) → Future< void> -
是否由 SDK 自动加载
libtencentloc.so。必须在 init 之前调用。 -
setPrivacyPolicyAgreement(
bool agreed) → Future< void> - 设置用户是否同意隐私政策。必须在调用任何其他 API 前调用。
-
setRtkLogEnabled(
bool enabled) → Future< void> - RTK 日志开关。
-
setSystemCacheEnabled(
bool enabled) → Future< void> - 是否允许定位失败时返回系统缓存位置。
- 是否上传 GPS 点用于导航增强。