auto_start_flutter
library
Functions
-
disableBatteryOptimization()
→ Future<void>
-
Open battery optimization settings
-
getAutoStartPermission()
→ Future<bool>
-
It navigates to settings => auto-start option where users can manually enable auto-start.
Returns
true if the settings page was opened, false otherwise.
-
getDeviceManufacturer()
→ Future<String?>
-
Get the device manufacturer name.
-
openAppInfo()
→ Future<void>
-
Open the App Info page in system settings.
This is useful as a fallback if specific auto-start settings cannot be opened.
-
openCustomSetting({required String packageName, required String activityName})
→ Future<bool>
-
Open a custom setting by package name and activity name.
This allows trying specific intents that are not yet natively supported by the plugin.
-
registerBootCallback(Function callback)
→ Future<bool>
-
Registers a callback to be executed headlessly when the device boots up.
Only supported on Android in Phase 1.
The
callback must be a top-level or static function decorated with @pragma('vm:entry-point').
-
startForegroundService({String title = "Running in background", String content = "Keep-alive service is active."})
→ Future<bool>
-
Starts a Foreground Service on Android.
This attaches a persistent notification to the status bar, preventing the OS from killing the app when it goes to the background.
title and content are used to populate the persistent notification.
Only supported on Android 8.0+.
-
stopForegroundService()
→ Future<bool>
-
Stops the Foreground Service on Android, resolving the persistent notification.