geofence 1.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 72

geofence #

This plugin help get geofence notification

Getting Started #

Android #

Add the following lines to your AndroidManifest.xml to register the background service for geofencing:

<receiver   android:name="com.webstersys.geofence.geofence.GeofenceBroadcastReceiver"
            android:exported="true" />
<service android:name="com.webstersys.geofence.geofence.GeofenceTransitionsJobIntentService" android:enabled="true" android:exported="true"
<receiver android:name="com.webstersys.geofence.BootDeviceReceiver">
                <action android:name="android.intent.action.BOOT_COMPLETED"/>

Also request the correct permissions for geofencing:

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

Finally, create either Application.kt or in the same directory as MainActivity.

For Application.kt, use the following:

class Application : FlutterApplication(), PluginRegistrantCallback {
  override fun onCreate() {

  override fun registerWith(registry: PluginRegistry) {

For, use the following:

public class Application extends FlutterApplication implements PluginRegistrantCallback {
  public void onCreate() {

  public void registerWith(PluginRegistry registry) {

Which must also be referenced in AndroidManifest.xml:

        android:name=".Application" />

0.0.1 #

  • Added Geofence Flutter Plugin With Only Android Support


*Gradle version updated

##1.0.3 *Notification part commented


import 'dart:isolate';
import 'dart:ui';

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:geofence/geofence.dart';
import 'package:geofence/geofence_event.dart';
import 'package:geofence/geofence_region.dart';
import 'package:geofence/location.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  _MyAppState createState() => new _MyAppState();

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';

  void initState() {
    // initPlatformState();

  static void callback(Location l, GeofenceEvent e) async {
    print('Location $l Event: $e');
    final SendPort send =

  Future<void> initGeofence() async {
    try {
      bool isInitialized = await Geofence.initialize();
      print("Geofence plugin initialzed : $isInitialized");
      var region = GeofenceRegion(Location(18.4825, 73.7973), 3000.00);
      bool geofenceAdded = await Geofence.registerGeofence(region, callback);
      //await Geofence.unRegisterGeofence();
    } catch (e) {

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String platformVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      platformVersion = await Geofence.platformVersion;
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;

  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Plugin example app'),
        body: new Center(
          child: new Text('Running on: $_platformVersion\n'),

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  geofence: ^1.0.3

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:geofence/geofence.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.9+1
  • Flutter: 1.17.3

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:geofence/geofence.dart]

Package does not support Flutter platform macos

Because of import path [package:geofence/geofence.dart]

Package does not support Flutter platform web

Because of import path [package:geofence/geofence.dart]

Package does not support Flutter platform windows

Because of import path [package:geofence/geofence.dart]

Package not compatible with SDK dart

because of import path [geofence]

Health suggestions

Format lib/geofence.dart.

Run flutter format to format lib/geofence.dart.

Maintenance suggestions

Package is getting outdated. (-56.71 points)

The package was last published 81 weeks ago.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.0
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8