move_to_bg 1.0.1 copy "move_to_bg: ^1.0.1" to clipboard
move_to_bg: ^1.0.1 copied to clipboard

A Flutter plugin to programmatically move your application to the background.

move_to_bg #

A Flutter plugin that allows you to programmatically move your application to the background.

Platform Support #

Platform Status Notes
Android ✅ Supported Uses official public API
iOS ⚠️ Caution Uses private API - see iOS Warning

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  move_to_bg: ^1.0.0

Usage #

import 'package:move_to_bg/move_to_bg';

// Move the app to the background
final moveToBg = MoveToBg();
await moveToBg.moveTaskToBack();

Platform Behavior #

Android #

The app will move to the background but remain in the recent apps list. The app will not be closed.

iOS #

⚠️ IMPORTANT: The iOS implementation uses UIApplication.suspend, which is a private API. Using this method may cause your app to be rejected during App Store review.

Use at your own risk. This plugin is recommended for:

  • Enterprise applications
  • Development builds
  • Applications distributed outside the App Store

There is currently no official public API available to programmatically move an iOS app to the background.

Example #

import 'package:flutter/material.dart';
import 'package:move_to_bg/move_to_bg';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Move to Background Example')),
        body: Center(
          child: ElevatedButton(
            onPressed: () async {
              final moveToBg = MoveToBg();
              await moveToBg.moveTaskToBack();
            },
            child: const Text('Move to Background'),
          ),
        ),
      ),
    );
  }
}

Requirements #

  • Android: min SDK 24+ (Android 7.0)
  • iOS: Deployment target 13.0+

License #

See LICENSE file for details.

0
likes
160
points
118
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin to programmatically move your application to the background.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on move_to_bg

Packages that implement move_to_bg