Skip to content

itsMatoosh/geofencing-awesome

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Author's Note: this plugin is not officially supported and is meant to be used as an example. Please feel free to pull it into your own projects, but there is no official version hosted on pub.dev and support may be limited. If you run into any issues running this sample, please file an issue or, even better, submit a pull request!

What is geofencing? here

Geofencing

A sample geofencing plugin with background execution support for Flutter.

Getting Started

This plugin works on both Android and iOS. Follow the instructions in the following sections for the platforms which are to be targeted.

Android

No additional setup required.

iOS

Add the following lines to your Info.plist:

<dict>
    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>YOUR DESCRIPTION HERE</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>YOUR DESCRIPTION HERE</string>
    ...

And request the correct permissions for geofencing:

<dict>
    ...
    <string>Main</string>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>location-services</string>
        <string>gps</string>
        <string>armv7</string>
    </array>
    <key>UIBackgroundModes</key>
    <array>
        <string>location</string>
    </array>
    ...
</dict>

Add this line to Runner-Briding-Header.h

#import <geofencing/GeofencingPlugin.h>

At the end add this line to AppDelegate.swift

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

Notes

Before register geofence request permissions for location and location always. You can use permission_handler package. Don't forget include this line in Podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
        config.build_settings['ENABLE_BITCODE'] = 'NO'
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
          '$(inherited)',
          'PERMISSION_LOCATION=1',
        ]
      end
  end
end

Need Help?

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

About

Flutter geofencing plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 42.3%
  • Dart 31.4%
  • Objective-C 19.0%
  • Ruby 7.3%