From 541cb9d01088cedcedf20706b1b7d5170bc30992 Mon Sep 17 00:00:00 2001 From: Ahmet Akil Date: Thu, 21 Aug 2025 15:06:01 +0300 Subject: [PATCH 1/4] Fix battery optimization not invoking callback --- .../FlutterBackgroundPlugin.kt | 1 + .../flutter_background/PermissionHandler.kt | 142 +++++++++++++----- 2 files changed, 102 insertions(+), 41 deletions(-) diff --git a/android/src/main/kotlin/de/julianassmann/flutter_background/FlutterBackgroundPlugin.kt b/android/src/main/kotlin/de/julianassmann/flutter_background/FlutterBackgroundPlugin.kt index 71b9cda..4903247 100644 --- a/android/src/main/kotlin/de/julianassmann/flutter_background/FlutterBackgroundPlugin.kt +++ b/android/src/main/kotlin/de/julianassmann/flutter_background/FlutterBackgroundPlugin.kt @@ -239,6 +239,7 @@ class FlutterBackgroundPlugin: FlutterPlugin, MethodCallHandler, ActivityAware { } private fun stopListeningToActivity() { + permissionHandler?.cleanup() this.activity = null permissionHandler = null } diff --git a/android/src/main/kotlin/de/julianassmann/flutter_background/PermissionHandler.kt b/android/src/main/kotlin/de/julianassmann/flutter_background/PermissionHandler.kt index 7537ca6..9c0af99 100644 --- a/android/src/main/kotlin/de/julianassmann/flutter_background/PermissionHandler.kt +++ b/android/src/main/kotlin/de/julianassmann/flutter_background/PermissionHandler.kt @@ -2,30 +2,35 @@ package de.julianassmann.flutter_background import android.Manifest import android.app.Activity +import android.app.Application import android.content.Context import android.content.Intent import android.content.pm.PackageManager import android.net.Uri import android.os.Build +import android.os.Bundle +import android.os.Handler +import android.os.Looper import android.os.PowerManager import android.provider.Settings import io.flutter.plugin.common.MethodChannel -import io.flutter.plugin.common.PluginRegistry -class PermissionHandler(private val context: Context, - private val addActivityResultListener: ((PluginRegistry.ActivityResultListener) -> Unit), - private val addRequestPermissionsResultListener: ((PluginRegistry.RequestPermissionsResultListener) -> Unit)) { +class PermissionHandler(private val context: Context) { companion object { - const val PERMISSION_CODE_IGNORE_BATTERY_OPTIMIZATIONS = 5672353 + private const val TAG = "PermissionHandler" + private const val TIMEOUT_MS = 60000L } - fun isWakeLockPermissionGranted(): Boolean - { + private var lifecycleCallback: Application.ActivityLifecycleCallbacks? = null + private var pendingBatteryOptimizationResult: MethodChannel.Result? = null + private var isWaitingForBatteryOptimization = false + + fun isWakeLockPermissionGranted(): Boolean { return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { context.checkSelfPermission(Manifest.permission.WAKE_LOCK) == PackageManager.PERMISSION_GRANTED } else { true - }; + } } fun isIgnoringBatteryOptimizations(): Boolean { @@ -38,54 +43,109 @@ class PermissionHandler(private val context: Context, } } - fun requestBatteryOptimizationsOff( - result: MethodChannel.Result, - activity: Activity) { + fun requestBatteryOptimizationsOff(result: MethodChannel.Result, activity: Activity) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { // Before Android M the battery optimization doesn't exist -> Always "ignoring" result.success(true) - } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - val powerManager = (context.getSystemService(Context.POWER_SERVICE) as PowerManager) - when { - powerManager.isIgnoringBatteryOptimizations(context.packageName) -> { - result.success(true) + return + } + + val powerManager = context.getSystemService(Context.POWER_SERVICE) as PowerManager + + when { + powerManager.isIgnoringBatteryOptimizations(context.packageName) -> { + result.success(true) + } + context.checkSelfPermission(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS) == PackageManager.PERMISSION_DENIED -> { + result.error( + "flutter_background.PermissionHandler", + "The app does not have the REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission required to ask the user for whitelisting.See the documentation on how to setup this plugin properly.", + null + ) + } + else -> { + setupLifecycleDetection(activity, result) + + val intent = Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS).apply { + data = Uri.parse("package:${context.packageName}") + } + + try { + activity.startActivity(intent) + } catch (e: Exception) { + cleanupLifecycleDetection() + result.error("BatteryOptimizationError", "Unable to request battery optimization permission", e.message) } - context.checkSelfPermission(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS) == PackageManager.PERMISSION_DENIED -> { - result.error( - "flutter_background.PermissionHandler", - "The app does not have the REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission required to ask the user for whitelisting. See the documentation on how to setup this plugin properly.", - null) + } + } + } + + private fun setupLifecycleDetection(activity: Activity, result: MethodChannel.Result) { + cleanupLifecycleDetection() + + pendingBatteryOptimizationResult = result + isWaitingForBatteryOptimization = true + + lifecycleCallback = object : Application.ActivityLifecycleCallbacks { + private var wasPaused = false + private val timeoutHandler = Handler(Looper.getMainLooper()) + private val timeoutRunnable = Runnable { handleBatteryOptimizationReturn() } + + override fun onActivityResumed(activity: Activity) { + if (wasPaused && isWaitingForBatteryOptimization) { + timeoutHandler.postDelayed({ handleBatteryOptimizationReturn() }, 500) } - else -> { - addActivityResultListener(PermissionActivityResultListener(result::success, result::error)) - val intent = Intent() - intent.action = Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS - intent.data = Uri.parse("package:${context.packageName}") - activity.startActivityForResult(intent, PERMISSION_CODE_IGNORE_BATTERY_OPTIMIZATIONS) + } + + override fun onActivityPaused(activity: Activity) { + if (isWaitingForBatteryOptimization) { + wasPaused = true + timeoutHandler.postDelayed(timeoutRunnable, TIMEOUT_MS) } } + + override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {} + override fun onActivityStarted(activity: Activity) {} + override fun onActivityStopped(activity: Activity) {} + override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {} + override fun onActivityDestroyed(activity: Activity) {} } + + activity.application.registerActivityLifecycleCallbacks(lifecycleCallback) } -} -class PermissionActivityResultListener( - private val onSuccess: (Any?) -> Unit, - private val onError: (String, String?, Any?) -> Unit) : PluginRegistry.ActivityResultListener { + private fun cleanupLifecycleDetection() { + lifecycleCallback?.let { callback -> + val app = context.applicationContext as Application + app.unregisterActivityLifecycleCallbacks(callback) + } + lifecycleCallback = null + pendingBatteryOptimizationResult = null + isWaitingForBatteryOptimization = false + } + + private fun handleBatteryOptimizationReturn() { + if (!isWaitingForBatteryOptimization || pendingBatteryOptimizationResult == null) { + return + } - private var alreadyCalled: Boolean = false; - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?): Boolean { try { - if (alreadyCalled || requestCode != PermissionHandler.PERMISSION_CODE_IGNORE_BATTERY_OPTIMIZATIONS) { - return false + val isIgnoringBatteryOptimizations = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + val powerManager = context.getSystemService(Context.POWER_SERVICE) as PowerManager + powerManager.isIgnoringBatteryOptimizations(context.packageName) + } else { + true } - alreadyCalled = true - - onSuccess(resultCode == Activity.RESULT_OK) - } catch (ex: Exception) { - onError("flutter_background.PermissionHandler", "Error while waiting for user to disable battery optimizations", ex.localizedMessage) + pendingBatteryOptimizationResult?.success(isIgnoringBatteryOptimizations) + } catch (e: Exception) { + pendingBatteryOptimizationResult?.error("BatteryOptimizationError", "Error checking permission status", e.message) + } finally { + cleanupLifecycleDetection() } + } - return true + fun cleanup() { + cleanupLifecycleDetection() } } \ No newline at end of file From af89f6e18cf58978297c20a4ea659a87080339dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20A=C3=9Fmann?= Date: Mon, 9 Mar 2026 18:35:45 +0100 Subject: [PATCH 2/4] Match PermissionHandler constructor in FlutterBackgroundPlugin The PermissionHandler constructor was changed to only accept context, but FlutterBackgroundPlugin was still passing 3 arguments. This fixes the compilation error. --- .../FlutterBackgroundPlugin.kt | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/android/src/main/kotlin/de/julianassmann/flutter_background/FlutterBackgroundPlugin.kt b/android/src/main/kotlin/de/julianassmann/flutter_background/FlutterBackgroundPlugin.kt index 4903247..12e6b65 100644 --- a/android/src/main/kotlin/de/julianassmann/flutter_background/FlutterBackgroundPlugin.kt +++ b/android/src/main/kotlin/de/julianassmann/flutter_background/FlutterBackgroundPlugin.kt @@ -14,7 +14,6 @@ import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodChannel import io.flutter.plugin.common.MethodChannel.MethodCallHandler import io.flutter.plugin.common.MethodChannel.Result -import io.flutter.plugin.common.PluginRegistry class FlutterBackgroundPlugin: FlutterPlugin, MethodCallHandler, ActivityAware { private var methodChannel : MethodChannel? = null @@ -201,10 +200,7 @@ class FlutterBackgroundPlugin: FlutterPlugin, MethodCallHandler, ActivityAware { } override fun onAttachedToActivity(binding: ActivityPluginBinding) { - startListeningToActivity( - binding.activity, - binding::addActivityResultListener, - binding::addRequestPermissionsResultListener) + startListeningToActivity(binding.activity) } override fun onDetachedFromActivityForConfigChanges() { @@ -226,16 +222,9 @@ class FlutterBackgroundPlugin: FlutterPlugin, MethodCallHandler, ActivityAware { context = null } - private fun startListeningToActivity( - activity: Activity, - addActivityResultListener: ((PluginRegistry.ActivityResultListener) -> Unit), - addRequestPermissionResultListener: ((PluginRegistry.RequestPermissionsResultListener) -> Unit) - ) { + private fun startListeningToActivity(activity: Activity) { this.activity = activity - permissionHandler = PermissionHandler( - activity.applicationContext, - addActivityResultListener, - addRequestPermissionResultListener) + permissionHandler = PermissionHandler(activity.applicationContext) } private fun stopListeningToActivity() { From 9bdeaf559159d88bbafcdbc316b85923066819ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20A=C3=9Fmann?= Date: Mon, 9 Mar 2026 21:35:53 +0100 Subject: [PATCH 3/4] Prepare release 1.3.1 --- CHANGELOG.md | 5 ++ example/README.md | 2 +- example/android/app/build.gradle | 4 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- example/android/settings.gradle | 4 +- example/pubspec.lock | 60 +++++++++---------- pubspec.lock | 60 +++++++++---------- 7 files changed, 72 insertions(+), 65 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ffc744..73d1699 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.3.1 + +* Fix battery optimization callback not being invoked on Android +* Update example app to use Gradle 8.7, AGP 8.6.0, and Kotlin 2.1.0 + ## 1.3.0+1 * Update README to not include unecessary `` in example `AndroidManifest.xml`, as these are already defined in the plugins `AndroidManifest.xml` diff --git a/example/README.md b/example/README.md index c333b13..cc4c280 100644 --- a/example/README.md +++ b/example/README.md @@ -20,7 +20,7 @@ You need to have the following tools installed: To start the server, go into the `server` folder and run ```bash -dart server.dart +dart server/server.dart ``` To start the app, go into the `app` folder and run diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 631f697..1671818 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -23,10 +23,12 @@ if (flutterVersionName == null) { } android { + namespace "de.julianassmann.flutter_background_example" compileSdkVersion flutter.compileSdkVersion ndkVersion flutter.ndkVersion compileOptions { + coreLibraryDesugaringEnabled true sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } @@ -60,5 +62,5 @@ flutter { // Version 10+ of flutter_local_notifications relies on desguaring to support scheduled notifications with backwards compatibility on older versions of Android. dependencies { - coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.2' + coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.4' } \ No newline at end of file diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index cc5527d..7aeeb11 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 38fca8a..f4e0879 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -18,8 +18,8 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "7.3.1" apply false - id "org.jetbrains.kotlin.android" version "1.7.10" apply false + id "com.android.application" version "8.6.0" apply false + id "org.jetbrains.kotlin.android" version "2.1.0" apply false } include ":app" \ No newline at end of file diff --git a/example/pubspec.lock b/example/pubspec.lock index cb177fb..6bb613b 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -37,26 +37,26 @@ packages: dependency: transitive description: name: characters - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.4.0" clock: dependency: transitive description: name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.2" collection: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.19.1" dbus: dependency: transitive description: @@ -69,10 +69,10 @@ packages: dependency: transitive description: name: fake_async - sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.3.3" ffi: dependency: transitive description: @@ -126,34 +126,34 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" url: "https://pub.dev" source: hosted - version: "10.0.5" + version: "11.0.2" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "3.0.10" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" matcher: dependency: transitive description: name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 url: "https://pub.dev" source: hosted - version: "0.12.16+1" + version: "0.12.17" material_color_utilities: dependency: transitive description: @@ -166,18 +166,18 @@ packages: dependency: transitive description: name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.17.0" path: dependency: transitive description: name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.9.1" petitparser: dependency: transitive description: @@ -198,7 +198,7 @@ packages: dependency: transitive description: flutter source: sdk - version: "0.0.99" + version: "0.0.0" source_span: dependency: transitive description: @@ -211,18 +211,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.12.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" string_scanner: dependency: transitive description: @@ -243,10 +243,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.7.7" timezone: dependency: transitive description: @@ -259,10 +259,10 @@ packages: dependency: transitive description: name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.2.0" vm_service: dependency: transitive description: @@ -288,5 +288,5 @@ packages: source: hosted version: "6.5.0" sdks: - dart: ">=3.3.0 <4.0.0" + dart: ">=3.8.0-0 <4.0.0" flutter: ">=3.18.0-18.0.pre.54" diff --git a/pubspec.lock b/pubspec.lock index e5a30c8..e5a8d95 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -21,34 +21,34 @@ packages: dependency: transitive description: name: characters - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.4.0" clock: dependency: transitive description: name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.2" collection: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.19.1" fake_async: dependency: transitive description: name: fake_async - sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.3.3" flutter: dependency: "direct main" description: flutter @@ -71,26 +71,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" url: "https://pub.dev" source: hosted - version: "10.0.5" + version: "11.0.2" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "3.0.10" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" lints: dependency: transitive description: @@ -103,10 +103,10 @@ packages: dependency: transitive description: name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 url: "https://pub.dev" source: hosted - version: "0.12.16+1" + version: "0.12.17" material_color_utilities: dependency: transitive description: @@ -119,18 +119,18 @@ packages: dependency: transitive description: name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.17.0" path: dependency: transitive description: name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.9.1" plugin_platform_interface: dependency: "direct main" description: @@ -143,7 +143,7 @@ packages: dependency: transitive description: flutter source: sdk - version: "0.0.99" + version: "0.0.0" source_span: dependency: transitive description: @@ -156,18 +156,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.12.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" string_scanner: dependency: transitive description: @@ -188,18 +188,18 @@ packages: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.7.7" vector_math: dependency: transitive description: name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.2.0" vm_service: dependency: transitive description: @@ -209,5 +209,5 @@ packages: source: hosted version: "14.2.4" sdks: - dart: ">=3.3.0 <4.0.0" + dart: ">=3.8.0-0 <4.0.0" flutter: ">=3.18.0-18.0.pre.54" From cce505fc1250a52f07d0c42544bca2221b4da470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20A=C3=9Fmann?= Date: Mon, 9 Mar 2026 21:38:06 +0100 Subject: [PATCH 4/4] Bump version to 1.3.1 and fix analyzer warning --- lib/src/flutter_background.dart | 1 - pubspec.yaml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/src/flutter_background.dart b/lib/src/flutter_background.dart index 5f5628c..15a2823 100644 --- a/lib/src/flutter_background.dart +++ b/lib/src/flutter_background.dart @@ -97,7 +97,6 @@ class FlutterBackground { case AndroidNotificationImportance.max: return 2; case AndroidNotificationImportance.normal: - default: return 0; } } diff --git a/pubspec.yaml b/pubspec.yaml index beda052..4dcc5f7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_background description: Run apps in the background using foreground services on Android. Ideal for applications that require continuous operation, such as background data synchronization or messaging. -version: 1.3.0+1 +version: 1.3.1 repository: https://github.com/JulianAssmann/flutter_background homepage: https://julianassmann.de/