Skip to content

Flutter beacons plugin for Android and iOS.

License

Notifications You must be signed in to change notification settings

vikramkapoor/beacons

Repository files navigation

Beacons

pub package

Flutter beacons plugin for Android API 16+ and iOS 9+.

Features:

  • Manual and automatic location permission management
  • Beacons ranging
  • Beacons monitoring

The plugin is under active development, only iOS is supported at that time.
Public API might change once the Android side is integrated.

Installation

Add beacons to your pubspec.yaml:

dependencies:
  beacons: ^0.0.2

Note: There is a known issue for integrating swift written plugin into Flutter project created with Objective-C template. See issue Flutter#16049 for help on integration.

Permission

Android and iOS require to declare the location permission in a configuration file.

For iOS

There are two kinds of location permission available in iOS: "when in use" and "always".

If you don't know what permission to choose for your usage, see: https://developer.apple.com/documentation/corelocation/choosing_the_authorization_level_for_location_services

You need to declare the description for the desired permission in ios/Runner/Info.plist:

<dict>
  <!-- for iOS 11 + -->
  <key>NSLocationWhenInUseUsageDescription</key>
  <string>Reason why app needs location</string>
  <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
  <string>Reason why app needs location</string>

  <!-- additionally for iOS 9/10, if you need always permission -->
  <key>NSLocationAlwaysUsageDescription</key>
  <string>Reason why app needs location</string>
  ...
</dict>

Getting started

Ranging beacons

Beacons.ranging(
  region: new BeaconRegion(
    proximityUUID: '7da11b71-6f6a-4b6d-81c0-8abd031e6113',
    identifier: 'test',
  ),
  inBackground: false,
).listen((result) {
  debugPrint('result = $result');
}

Monitoring beacons

Beacons.monitoring(
  region: new BeaconRegion(
    proximityUUID: '7da11b71-6f6a-4b6d-81c0-8abd031e6113',
    identifier: 'test',
  ),
  inBackground: false,
).listen((result) {
  debugPrint('result = $result');
}

Sponsor

Beacons plugin development is sponsored by Pointz

Author

Beacons plugin is developed by Loup, a mobile development studio based in Montreal and Paris.
You can contact us at hello@intheloup.io

License

Apache License 2.0

About

Flutter beacons plugin for Android and iOS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Dart 35.7%
  • Swift 33.1%
  • Kotlin 30.1%
  • Other 1.1%