Skip to content

Latest commit

 

History

History
149 lines (95 loc) · 3.72 KB

utility_documentation.md

File metadata and controls

149 lines (95 loc) · 3.72 KB

Utility

🍭 minimizeApp

Minimize the app to the background.

Warning It only works when the app is in the foreground.

void function() => FlutterForegroundTask.minimizeApp();

🍭 launchApp (Android)

Launch the app at route if it is not running otherwise open it.

It is also possible to pass a route to this function but the route will only be loaded if the app is not already running.

void function() => FlutterForegroundTask.launchApp([route]);

🍭 setOnLockScreenVisibility (Android)

Toggles lockScreen visibility.

Warning It only works when the app is in the foreground.

void function() => FlutterForegroundTask.setOnLockScreenVisibility(true);

🍭 isAppOnForeground

Returns whether the app is in the foreground.

Future<bool> function() => FlutterForegroundTask.isAppOnForeground;

🍭 wakeUpScreen (Android)

Wake up the screen of a device that is turned off.

void function() => FlutterForegroundTask.wakeUpScreen();

🍭 isIgnoringBatteryOptimizations (Android)

Returns whether the app has been excluded from battery optimization.

Future<bool> function() => FlutterForegroundTask.isIgnoringBatteryOptimizations;

🍭 openIgnoreBatteryOptimizationSettings (Android)

Open the settings page where you can set ignore battery optimization.

Warning It only works when the app is in the foreground.

Future<bool> function() => FlutterForegroundTask.openIgnoreBatteryOptimizationSettings();

🍭 requestIgnoreBatteryOptimization (Android)

Request to ignore battery optimization.

This function requires android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission.

Warning It only works when the app is in the foreground.

Future<bool> function() => FlutterForegroundTask.requestIgnoreBatteryOptimization();

🍭 canDrawOverlays (Android)

Returns whether the android.permission.SYSTEM_ALERT_WINDOW permission is granted.

Future<bool> function() => FlutterForegroundTask.canDrawOverlays;

🍭 openSystemAlertWindowSettings (Android)

Open the settings page where you can allow/deny the android.permission.SYSTEM_ALERT_WINDOW permission.

Warning It only works when the app is in the foreground.

Future<bool> function() => FlutterForegroundTask.openSystemAlertWindowSettings();

🍭 checkNotificationPermission

Returns notification permission status.

Warning It only works when the app is in the foreground.

Future<NotificationPermission> function() => FlutterForegroundTask.checkNotificationPermission();

🍭 requestNotificationPermission

Request notification permission.

Warning It only works when the app is in the foreground.

Future<NotificationPermission> function() => FlutterForegroundTask.requestNotificationPermission();

🍭 canScheduleExactAlarms (Android)

Returns whether the android.permission.SCHEDULE_EXACT_ALARM permission is granted.

Future<bool> function() => FlutterForegroundTask.canScheduleExactAlarms;

🍭 openAlarmsAndRemindersSettings (Android)

Open the alarms & reminders settings page.

Use this utility only if you provide services that require long-term survival, such as exact alarm service, healthcare service, or Bluetooth communication.

This utility requires the android.permission.SCHEDULE_EXACT_ALARM permission. Using this permission may make app distribution difficult due to Google policy.

Warning It only works when the app is in the foreground.

Future<bool> function() => FlutterForegroundTask.openAlarmsAndRemindersSettings();