패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.5.1

flutter_beacon

Android 및 iOS에서 스캔하고 비콘(iBeacon)으로 전송하기 위한 Flutter 플러그인입니다.

AndroidiOS
30일 다운로드
282
좋아요
88
Pub 점수
140

패키지 설치

flutter pub add flutter_beacon

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Flutter Beacon은 Android 및 iOS 기기에서 블루투스 저에너지(BLE) 비콘 스캔 및 전송을 가능하게 하는 크로스 플랫폼 플러그인입니다. iBeacon 기능을 지원하여 개발자가 근처의 비콘을 감지하거나 비콘 신호를 방송할 수 있습니다. Flutter 앱에 원활하게 통합되며, 탐색 모드와 광고 모드 모두에 간편한 API를 제공합니다. 실내 탐색, 자산 추적, 위치 인식 서비스와 같은 근접 기반 애플리케이션에 적합합니다. 두 플랫폼의 네이티브 BLE 기능과 호환됩니다.

사용 사례

  • 실내 탐색 시스템
  • 자산 및 장치 추적
  • 프록시미티 마케팅
  • 위치 기반 트리거
  • 스마트 리테일 경험

주요 기능

  • iBeacon 스캔 및 전송
  • 크로스 플랫폼 지원 (Android 및 iOS)
  • 간단한 Flutter API
  • 실시간 비콘 감지
  • 저전력 소비

적합한 대상

  • 근접 앱을 개발하는 개발자
  • 실내 위치 추적을 필요로 하는 앱
  • 소매 및 환대 솔루션
  • 사물인터넷 장치 통합
  • 이벤트 기반 모바일 애플리케이션

고려 사항

  • 모든 플랫폼에서 블루투스 권한이 필요합니다
  • 백그라운드 작업은 운영 체제 제한에 의해 제한될 수 있습니다
  • 연속 스캔 중에는 배터리 사용량을 모니터링해야 합니다
  • 정확도는 환경 요인에 따라 달라집니다
  • iOS 백그라운드 모드는 추가 구성이 필요합니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

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 <maulana@cubeacon.com>.

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.