{"id":22050142,"url":"https://github.com/icapps/flutter-background-location-tracker","last_synced_at":"2025-04-07T08:17:34.859Z","repository":{"id":45730772,"uuid":"321623010","full_name":"icapps/flutter-background-location-tracker","owner":"icapps","description":"Flutter background location tracker plugin. (Android / iOS)","archived":false,"fork":false,"pushed_at":"2025-03-10T09:06:33.000Z","size":279,"stargazers_count":33,"open_issues_count":13,"forks_count":43,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-31T07:05:43.666Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/icapps.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-15T09:50:31.000Z","updated_at":"2025-03-16T18:04:25.000Z","dependencies_parsed_at":"2025-01-15T09:28:01.628Z","dependency_job_id":"5e0e5e18-bff8-432d-9182-bcde3c19d057","html_url":"https://github.com/icapps/flutter-background-location-tracker","commit_stats":{"total_commits":127,"total_committers":5,"mean_commits":25.4,"dds":0.2755905511811023,"last_synced_commit":"2a9f794b25b51aec031821d91d7280fe28f928f7"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Fflutter-background-location-tracker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Fflutter-background-location-tracker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Fflutter-background-location-tracker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Fflutter-background-location-tracker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icapps","download_url":"https://codeload.github.com/icapps/flutter-background-location-tracker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247615383,"owners_count":20967184,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-30T14:18:00.458Z","updated_at":"2025-04-07T08:17:34.840Z","avatar_url":"https://github.com/icapps.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# background_location_tracker\n\nA new Flutter plugin that allows you to track the background location for Android \u0026 iOS\n\n[![Build Status](https://travis-ci.com/icapps/flutter-background-location-tracker.svg?branch=master)](https://travis-ci.com/icapps/flutter-background-location-tracker)\n[![Coverage Status](https://coveralls.io/repos/github/icapps/flutter-background-location-tracker/badge.svg?branch=master)](https://coveralls.io/github/icapps/flutter-background-location-tracker?branch=master)\n[![pub package](https://img.shields.io/pub/v/background_location_tracker.svg)](https://pub.dartlang.org/packages/background_location_tracker)\n\n## Android Config\n\n### Update compile sdk\n\nCompile sdk should be at 29 at least.\n```\nandroid {\n  ...\n  compileSdkVersion 29\n  ...\n\n  defaultConfig {\n    ...\n    targetSdkVersion 29\n    ...\n  }\n  ...\n}\n```\n\n## iOS Configuration\n\n### Update Info.plist\n\nAdd the correct permission descriptions\n```\n\t\u003ckey\u003eNSLocationAlwaysAndWhenInUseUsageDescription\u003c/key\u003e\n\t\u003cstring\u003eYour description why you should use NSLocationAlwaysAndWhenInUseUsageDescription\u003c/string\u003e\n\t\u003ckey\u003eNSLocationAlwaysUsageDescription\u003c/key\u003e\n\t\u003cstring\u003eYour description why you should use NSLocationAlwaysAndWhenInUseUsageDescription\u003c/string\u003e\n\t\u003ckey\u003eNSLocationWhenInUseUsageDescription\u003c/key\u003e\n\t\u003cstring\u003eYour description why you should use NSLocationAlwaysAndWhenInUseUsageDescription\u003c/string\u003e\n```\n\nAdd the background location updates in xcode\n\nOr add the info to the Info.plist\n\n```\n\t\u003ckey\u003eUIBackgroundModes\u003c/key\u003e\n\t\u003carray\u003e\n\t\t\u003cstring\u003elocation\u003c/string\u003e\n\t\u003c/array\u003e\n```\n\n### Update the AppDelegate\n\nMake sure you call the `setPluginRegistrantCallback` so other plugins can be accessed in the background.\n\n```\nimport UIKit\nimport Flutter\nimport background_location_tracker\n\n@UIApplicationMain\n@objc class AppDelegate: FlutterAppDelegate {\n    override func application(_ application: UIApplication,didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -\u003e Bool {\n        GeneratedPluginRegistrant.register(with: self)\n\n        BackgroundLocationTrackerPlugin.setPluginRegistrantCallback { registry in\n            GeneratedPluginRegistrant.register(with: registry)\n        }\n\n        return super.application(application, didFinishLaunchingWithOptions: launchOptions)\n    }\n}\n```\n\n## Flutter implementation\n\nMake sure you set the `@pragma('vm:entry-point')` to make sure you can find the callback in release.\n\n```\n@pragma('vm:entry-point')\nvoid backgroundCallback() {\n  BackgroundLocationTrackerManager.handleBackgroundUpdated(\n    (data) async =\u003e Repo().update(data),\n  );\n}\n\nFuture\u003cvoid\u003e main() async {\n  WidgetsFlutterBinding.ensureInitialized();\n  await BackgroundLocationTrackerManager.initialize(\n    backgroundCallback,\n    config: const BackgroundLocationTrackerConfig(\n      loggingEnabled: true,\n      androidConfig: AndroidConfig(\n        notificationIcon: 'explore',\n        trackingInterval: Duration(seconds: 4),\n        distanceFilterMeters: null,\n      ),\n      iOSConfig: IOSConfig(\n        activityType: ActivityType.FITNESS,\n        distanceFilterMeters: null,\n        restartAfterKill: true,\n      ),\n    ),\n  );\n\n  runApp(MyApp());\n}\n\nFuture startLocationTracking() async {\n  await BackgroundLocationTrackerManager.startTracking();\n}\n\nFuture stopLocationTracking() async {\n  await BackgroundLocationTrackerManager.stopTracking();\n}\n\n```\n\n# FAQ:\n\n#### I get a Unhandled Exception: MissingPluginException(No implementation found for method .... on channel ...)\n\n```\nThis is mostly caused by a misconfiguration of the plugin:\nAndroid Pre v2 embedding: make sure the plugin registrant callback is set\nAndroid v2 embedding: Log a new github issues. This\niOS: make sure the plugin registrant callback is set\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficapps%2Fflutter-background-location-tracker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficapps%2Fflutter-background-location-tracker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficapps%2Fflutter-background-location-tracker/lists"}