Skip to content

Commit d69560b

Browse files
committed
release: 9.1.0
1 parent ef9b76e commit d69560b

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 9.1.0
2+
3+
* [**FEAT**] Support manual foregroundServiceType via serviceTypes in startService
4+
15
## 9.0.0
26

37
* [**CHORE**] Bump minimum supported SDK version to `Flutter 3.22/Dart 3.4`

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ To use this plugin, add `flutter_foreground_task` as a [dependency in your pubsp
2727

2828
```yaml
2929
dependencies:
30-
flutter_foreground_task: ^9.0.0
30+
flutter_foreground_task: ^9.1.0
3131
```
3232
3333
After adding the plugin to your flutter project, we need to declare the platform-specific permissions ans service to use for this plugin to work properly.
@@ -41,10 +41,8 @@ This plugin requires `Kotlin version 1.9.10+` and `Gradle version 8.6.0+`. Pleas
4141
- [app/build.gradle](https://github.com/Dev-hwang/flutter_foreground_task/blob/master/example/android/app/build.gradle)
4242
- [migration_documentation](https://github.com/Dev-hwang/flutter_foreground_task/blob/master/documentation/migration_documentation.md)
4343

44-
Open the `AndroidManifest.xml` file and declare the service tag inside the `<application>` tag as follows.
45-
46-
If you want the foreground service to run only when the app is running, add `android:stopWithTask="true"`.
47-
44+
Open the `AndroidManifest.xml` file and declare the service tag inside the `<application>` tag as follows.
45+
If you want the foreground service to run only when the app is running, add `android:stopWithTask="true"`.
4846
As mentioned in the Android guidelines, to start a FG service on Android 14+, you must declare `android:foregroundServiceType`.
4947

5048
* [`camera`](https://developer.android.com/about/versions/14/changes/fgs-types-required#camera)
@@ -379,6 +377,12 @@ Future<ServiceRequestResult> _startService() async {
379377
return FlutterForegroundTask.restartService();
380378
} else {
381379
return FlutterForegroundTask.startService(
380+
// You can manually specify the foregroundServiceType for the service
381+
// to be started, as shown in the comment below.
382+
// serviceTypes: [
383+
// ForegroundServiceTypes.dataSync,
384+
// ForegroundServiceTypes.remoteMessaging,
385+
// ],
382386
serviceId: 256,
383387
notificationTitle: 'Foreground Service is running',
384388
notificationText: 'Tap to return to the app',

example/lib/main.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@ class _ExamplePageState extends State<ExamplePage> {
166166
return FlutterForegroundTask.restartService();
167167
} else {
168168
return FlutterForegroundTask.startService(
169+
// You can manually specify the foregroundServiceType for the service
170+
// to be started, as shown in the comment below.
171+
// serviceTypes: [
172+
// ForegroundServiceTypes.dataSync,
173+
// ForegroundServiceTypes.remoteMessaging,
174+
// ],
169175
serviceId: 256,
170176
notificationTitle: 'Foreground Service is running',
171177
notificationText: 'Tap to return to the app',

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_foreground_task
22
description: This plugin is used to implement a foreground service on the Android platform.
3-
version: 9.0.0
3+
version: 9.1.0
44
homepage: https://github.com/Dev-hwang/flutter_foreground_task
55

66
environment:

0 commit comments

Comments
 (0)