enableForeground method
启用前台定位服务,让定位在应用进入后台时也能继续运行。
Platforms:
- 🅰️ Android:支持
- 🍏 iOS:不支持,抛出
TencentLocationError(错误码unsupportedOnThisPlatform) - 🔶 Harmony:不支持,抛出
TencentLocationError(错误码unsupportedOnThisPlatform)
Parameters:
notificationId:前台通知的唯一 ID,必须大于 0。channelId:Android O(API 26)及以上版本必填的NotificationChannelID。title:通知栏展示的标题文案。text:通知栏展示的正文文案。smallIconResourceName:通知小图标的资源名(位于mipmap/drawable下,不含扩展名);为空时使用应用默认图标。
Implementation
Future<void> enableForeground({
required int notificationId,
required String channelId,
required String title,
required String text,
String? smallIconResourceName,
}) =>
_after(() => _platform.enableForeground(
managerId: _id,
notificationId: notificationId,
channelId: channelId,
title: title,
text: text,
smallIconResourceName: smallIconResourceName,
));