background_location_tracker 1.0.2
background_location_tracker: ^1.0.2 copied to clipboard

A Flutter plugin that allows you to track the background location for Android & iOS

background_location_tracker #

A new Flutter plugin that allows you to track the background location for Android & iOS

Build Status Coverage Status pub package

Android Config #

Update compile sdk #

Compile sdk should be at 29 at least.

android {
  ...
  compileSdkVersion 29
  ...

  defaultConfig {
    ...
    targetSdkVersion 29
    ...
  }
  ...
}

iOS Configuration #

Update Info.plist #

Add the correct permission descriptions

	<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
	<string>Your description why you should use NSLocationAlwaysAndWhenInUseUsageDescription</string>
	<key>NSLocationAlwaysUsageDescription</key>
	<string>Your description why you should use NSLocationAlwaysAndWhenInUseUsageDescription</string>
	<key>NSLocationWhenInUseUsageDescription</key>
	<string>Your description why you should use NSLocationAlwaysAndWhenInUseUsageDescription</string>

Add the background location updates in xcode

Or add the info to the Info.plist

	<key>UIBackgroundModes</key>
	<array>
		<string>location</string>
	</array>

Update the AppDelegate #

Make sure you call the setPluginRegistrantCallback so other plugins can be accessed in the background.

import UIKit
import Flutter
import background_location_tracker

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
    override func application(_ application: UIApplication,didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        GeneratedPluginRegistrant.register(with: self)

        BackgroundLocationTrackerPlugin.setPluginRegistrantCallback { registry in
            GeneratedPluginRegistrant.register(with: registry)
        }

        return super.application(application, didFinishLaunchingWithOptions: launchOptions)
    }
}

FAQ:

I get a Unhandled Exception: MissingPluginException(No implementation found for method .... on channel ...)

This is mostly caused by a misconfiguration of the plugin:
Android Pre v2 embedding: make sure the plugin registrant callback is set
Android v2 embedding: Log a new github issues. This
iOS: make sure the plugin registrant callback is set
3
likes
120
pub points
49%
popularity

Publisher

icapps.com

A Flutter plugin that allows you to track the background location for Android & iOS

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on background_location_tracker