background_task 0.0.1+1 copy "background_task: ^0.0.1+1" to clipboard
background_task: ^0.0.1+1 copied to clipboard

Even if the application transitions to the background, it can be processed using location updates.

background_task #

Motivation #

Enable developers to continue processing even when the application transitions to the background, we have created a package that allows processing to continue using location updates.This package was created with reference to background_location.

Usage #

// Monitor notifications of background processes.
BackgroundTask.instance.stream.listen((event) {
    // Implement the process you want to run in the background.
});

// Start background processing with location updates.
// Android only: Start Foreground service. If you want to show foreground service notifications, please execute a notification permission request before start.
await BackgroundTask.instance.start();

// Stop background processing and location updates.
await BackgroundTask.instance.stop();

Setup #

pubspec.yaml

dependencies:
  background_task:

iOS: Info.plist

<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>This app needs access to location.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>This app needs access to location.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app needs access to location.</string>
<key>UIBackgroundModes</key>
<array>
    <string>fetch</string>
    <string>location</string>
</array>

Android: AndroidManifest.xml

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/> 
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

<!-- option -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
18
likes
0
pub points
74%
popularity

Publisher

verified publisherneverjp.com

Even if the application transitions to the background, it can be processed using location updates.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on background_task