All Projects → alann-maulana → flutter_beacon

alann-maulana / flutter_beacon

Licence: Apache-2.0 license
An hybrid iBeacon scanner and transmitter SDK for Flutter Android and iOS.

Programming Languages

dart
5743 projects
java
68154 projects - #9 most used programming language
objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language
Makefile
30231 projects
shell
77523 projects
kotlin
9241 projects

Projects that are alternatives of or similar to flutter beacon

plugins
Flutter plugins for Tizen
Stars: ✭ 40 (-56.52%)
Mutual labels:  flutter-plugin
davinci
A flutter package to convert any widget to an Image.
Stars: ✭ 33 (-64.13%)
Mutual labels:  flutter-plugin
navigate
A flutter plugin for byutifull navigation with advanced routing
Stars: ✭ 40 (-56.52%)
Mutual labels:  flutter-plugin
pal-plugin
The Flutter onboarding editor
Stars: ✭ 16 (-82.61%)
Mutual labels:  flutter-plugin
flutter-google-api-availability
Check the availability of Google Play services on the current device
Stars: ✭ 26 (-71.74%)
Mutual labels:  flutter-plugin
GuideChimp
Create interactive guided product tours in minutes with the most non-technical friendly, lightweight and extendable library.
Stars: ✭ 138 (+50%)
Mutual labels:  beacon
aestheticDialogs
📱 Flutter Plugin for 💫fluid, 😍beautiful, 🎨custom Dialogs
Stars: ✭ 19 (-79.35%)
Mutual labels:  flutter-plugin
flutter scan
scanner qrcode in widget tree & decoder qrcode from image
Stars: ✭ 63 (-31.52%)
Mutual labels:  flutter-plugin
flutter chameleon
[UNMAINTAINED] Flutter package to show platform **dependent** widgets.
Stars: ✭ 30 (-67.39%)
Mutual labels:  flutter-plugin
rtlsdr-wsprd
WSPR daemon for RTL receivers
Stars: ✭ 93 (+1.09%)
Mutual labels:  beacon
E-commerce
A Flutter E-commerce by implementing the Carousel and other flutter components
Stars: ✭ 36 (-60.87%)
Mutual labels:  flutter-plugin
FlutterLoadingGIFs
Loading indicator GIFs. Material and Cupertino (Android and iOS) loading indicators in assorted sizes. Use as placeholders for loading remote image assets. Demo: https://gallery.codelessly.com/flutterwebsites/loadinggifs/
Stars: ✭ 28 (-69.57%)
Mutual labels:  flutter-plugin
flutter isolate
Launch an isolate that can use flutter plugins.
Stars: ✭ 157 (+70.65%)
Mutual labels:  flutter-plugin
PiBeacon
Low-cost iBeacon using Raspberry Pi
Stars: ✭ 41 (-55.43%)
Mutual labels:  beacon
iBeacon-Android
iBeacon scanner and simulator - Android application example
Stars: ✭ 28 (-69.57%)
Mutual labels:  beacon
flutter custom tabs
A Flutter plugin to use Chrome Custom Tabs.
Stars: ✭ 117 (+27.17%)
Mutual labels:  flutter-plugin
flutter wasm
WebAssembly interpreter for Flutter apps.
Stars: ✭ 22 (-76.09%)
Mutual labels:  flutter-plugin
gen lang
gen_lang is a dart library for internationalization. Extracts messages to generate dart files required by Intl, inspired by Intl_translation and Flutter i18n
Stars: ✭ 94 (+2.17%)
Mutual labels:  flutter-plugin
flutter-geocoding
A Geocoding plugin for Flutter
Stars: ✭ 88 (-4.35%)
Mutual labels:  flutter-plugin
ios
CoThings's iOS application. CoThings is a realtime counter for shared things.
Stars: ✭ 13 (-85.87%)
Mutual labels:  beacon

Flutter Beacon

Pub GitHub Build Coverage Status FOSSA Status codecov

Flutter plugin to work with iBeacons.

An hybrid iBeacon scanner and transmitter SDK for Flutter plugin. Supports Android API 18+ and iOS 8+.

Features:

  • Automatic permission management
  • Ranging iBeacons
  • Monitoring iBeacons
  • Transmit as iBeacon

Installation

Add to pubspec.yaml:

dependencies:
  flutter_beacon: latest

Setup specific for Android

For target SDK version 29+ (Android 10, 11) is necessary to add manually ACCESS_FINE_LOCATION

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

and if you want also background scanning:

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

Setup specific for iOS

In order to use beacons related features, apps are required to ask the location permission. It's a two step process:

  1. Declare the permission the app requires in configuration files
  2. Request the permission to the user when app is running (the plugin can handle this automatically)

The needed permissions in iOS is when in use.

For more details about what you can do with each permission, see:
https://developer.apple.com/documentation/corelocation/choosing_the_authorization_level_for_location_services

Permission must be declared in ios/Runner/Info.plist:

<dict>
  <!-- When in use -->
  <key>NSLocationWhenInUseUsageDescription</key>
  <string>Reason why app needs location</string>
  <!-- Always -->
  <!-- for iOS 11 + -->
  <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
  <string>Reason why app needs location</string>
  <!-- for iOS 9/10 -->
  <key>NSLocationAlwaysUsageDescription</key>
  <string>Reason why app needs location</string>
  <!-- Bluetooth Privacy -->
  <!-- for iOS 13 + -->
  <key>NSBluetoothAlwaysUsageDescription</key>
  <string>Reason why app needs bluetooth</string>
</dict>

iOS Troubleshooting

  • Example code works properly only on physical device (bluetooth on simulator is disabled)
  • How to deploy flutter app on iOS device Instruction
  • If example code don't works on device (beacons not appear), please make sure that you have enabled
    Location and Bluetooth (Settings -> Flutter Beacon)

How-to

Ranging APIs are designed as reactive streams.

  • The first subscription to the stream will start the ranging

Initializing Library

try {
  // if you want to manage manual checking about the required permissions
  await flutterBeacon.initializeScanning;
  
  // or if you want to include automatic checking permission
  await flutterBeacon.initializeAndCheckScanning;
} on PlatformException catch(e) {
  // library failed to initialize, check code and message
}

Ranging beacons

final regions = <Region>[];

if (Platform.isIOS) {
  // iOS platform, at least set identifier and proximityUUID for region scanning
  regions.add(Region(
      identifier: 'Apple Airlocate',
      proximityUUID: 'E2C56DB5-DFFB-48D2-B060-D0F5A71096E0'));
} else {
  // android platform, it can ranging out of beacon that filter all of Proximity UUID
  regions.add(Region(identifier: 'com.beacon'));
}

// to start ranging beacons
_streamRanging = flutterBeacon.ranging(regions).listen((RangingResult result) {
  // result contains a region and list of beacons found
  // list can be empty if no matching beacons were found in range
});

// to stop ranging beacons
_streamRanging.cancel();

Monitoring beacons

final regions = <Region>[];

if (Platform.isIOS) {
  // iOS platform, at least set identifier and proximityUUID for region scanning
  regions.add(Region(
      identifier: 'Apple Airlocate',
      proximityUUID: 'E2C56DB5-DFFB-48D2-B060-D0F5A71096E0'));
} else {
  // Android platform, it can ranging out of beacon that filter all of Proximity UUID
  regions.add(Region(identifier: 'com.beacon'));
}

// to start monitoring beacons
_streamMonitoring = flutterBeacon.monitoring(regions).listen((MonitoringResult result) {
  // result contains a region, event type and event state
});

// to stop monitoring beacons
_streamMonitoring.cancel();

Under the hood

Author

Flutter Beacon plugin is developed by Eyro Labs. You can contact me at [email protected].

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].