flutter_generic_location 0.0.1 copy "flutter_generic_location: ^0.0.1" to clipboard
flutter_generic_location: ^0.0.1 copied to clipboard

A Flutter plugin for fetching location in the foreground and background on Android and iOS.

flutter_generic_location #

A Flutter plugin for fetching location in the foreground and background on Android and iOS.

Platform #

  • ✅ Android
  • ✅ iOS

Features #

  • Can request location permission.
  • Can get the current location of the device.
  • Can subscribe to LocationStream to collect location data in real time.

Getting started #

To use this plugin, add flutter_generic_location as a dependency in your pubspec.yaml file. For example:

dependencies:
  flutter_generic_location: ^0.0.1

After adding the flutter_generic_location plugin to the flutter project, we need to specify the platform-specific permissions for this plugin to work properly.

🐤 Android #

Since this plugin works based on location, we need to add the following permission to the AndroidManifest.xml file. Open the AndroidManifest.xml file and specify it between the <manifest> and <application> tags.

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

If you want to get the location in the background, add the following permission. If your project supports Android 10, be sure to add the ACCESS_BACKGROUND_LOCATION permission.

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

🐤 iOS #

Like the Android platform, this plugin works based on location, we need to add the following description. Open the ios/Runner/Info.plist file and specify it inside the <dict> tag.

<key>NSLocationWhenInUseUsageDescription</key>
<string>Used to collect location data.</string>

If you want to get the location in the background, add the following description.

<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Used to collect location data in the background.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Used to collect location data in the background.</string>
<key>UIBackgroundModes</key>
<array>
    <string>fetch</string>
    <string>location</string>
</array>

Support #

If you find any bugs or issues while using the plugin, please register an issues on GitHub.

1
likes
130
points
14
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for fetching location in the foreground and background on Android and iOS.

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flutter_generic_location

Packages that implement flutter_generic_location