EasyGeofencing은 Android 및 iOS용 최적화된 백그라운드 지오페싱 서비스를 제공하는 Dart 패키지로, Web과 macOS도 지원합니다. 앱이 백그라운드에 있을 때에도 사용자가 정의된 영역에 진입하거나 탈출할 경우 이벤트를 트리거할 수 있도록 해줍니다. 네이티브 플랫폼 기능과의 통합을 간소화하여 효율적인 배터리 사용과 신뢰할 수 있는 위치 추적을 보장합니다. 실시간 위치 기반 애플리케이션을 위한 설계로, 여러 플랫폼에서 지오페싱을 관리하기 위한 간편한 API를 제공합니다.
사용 사례
실시간 위치 추적
위치 기반 알림
자산 추적
배송 및 물류 모니터링
사용자 체크인 시스템
주요 기능
크로스 플랫폼 지원 (Android, iOS, Web, macOS)
효율적인 백그라운드 지오페싱
낮은 배터리 소모
지오패스 관리용 간단한 API
실시간 입실/퇴실 이벤트 감지
적합한 대상
위치 인식이 필요한 모바일 앱
물류 및 배송 서비스
피트니스 및 야외 활동 앱
소매 및 마케팅 캠페인
스마트 홈 및 사물인터넷 통합
고려 사항
모든 플랫폼에서 위치 권한이 필요합니다
백그라운드 실행은 운영체제 정책에 따라 달라질 수 있습니다
배터리 최적화 설정은 성능에 영향을 줄 수 있습니다
일부 기기에서는 지오페인스 반경 제약에 제한됨
권한 요청 및 사용자 동의에 대한 적절한 처리가 필요합니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
EASY GEOFENCING
Easy Geofencing is a flutter geofencing package for flutter application (android & ios) which provides geofencing functionalities.It is completely written in pure dart language.
FEATURES
Geofence status triggered on location changes[init,enter,exit] as a geofence Status
Get continuous geofence status updates
Optimized dart code
battery optimized dart package
USAGE
To add the easy_geofencing to your flutter application read the install instructions. Below are some Android and iOS specifics that are required for the easy_geofencing to work correctly.
FOR ANDROID
AndroidX
The easy_geofencing plugin requires the AndroidX version of the Android Support Libraries. This means you need to make sure your Android project supports AndroidX. Detailed instructions can be found here.
The TL;DR version is:
Add the following to your "gradle.properties" file:
Make sure you set the compileSdkVersion in your "android/app/build.gradle" file to 30:
android {
compileSdkVersion 30
...
}
Make sure you replace all the android. dependencies to their AndroidX counterparts (a full list can be found here: https://developer.android.com/jetpack/androidx/migrate).
Permissions
On Android you'll need to add either the ACCESS_COARSE_LOCATION or the ACCESS_FINE_LOCATION permission to your Android Manifest. To do so open the AndroidManifest.xml file (located under android/app/src/main) and add one of the following two lines as direct children of the <manifest> tag (when you configure both permissions the ACCESS_FINE_LOCATION will be used):
Starting from Android 10 you need to add the ACCESS_BACKGROUND_LOCATION permission (next to the ACCESS_COARSE_LOCATION or the ACCESS_FINE_LOCATION permission) if you want to continue receiving updates even when your App is running in the background (note that the easy_geofencing plugin doesn't support receiving an processing geofence status updates while running in the background):
On iOS you'll need to add the following entries to your Info.plist file (located under ios/Runner) in order to access the device's location. Simply open your Info.plist file and add the following:
<key>NSLocationWhenInUseUsageDescription</key><string>This app needs access to location when open.</string><key>NSLocationAlwaysUsageDescription</key><string>This app needs access to location when in the background.</string>
If you would like to receive updates when your App is in the background, you'll also need to add the Background Modes capability to your XCode project (Project > Signing and Capabilities > "+ Capability" button) and select Location Updates. Be careful with this, you will need to explain in detail to Apple why your App needs this when submitting your App to the AppStore. If Apple isn't satisfied with the explanation your App will be rejected.
API
START EASY GEOFENCING SERVICES
At first you need to start the geofence service and for that you need to pass the following arguments:
pointedLatitude: the latitude of the geofence area center
pointedLongitude: the longitude of the geofence area center
radiusInMeter: the radius of the geofence area in meters
eventPeriodInSeconds: geofence status stream period in seconds
To get the stream geofence Status updates on location changes, you need to subscribe getGeofenceStream to listen geofence status streams on current location updates.
Also, stop GeofenceStatus stream subscription listener which is geofenceStatusStream in our case
geofenceStatusStream.cancel();
Issues
Please file any issues, bugs or feature requests as an issue on our GitHub page.
Dependencies
This plugin is depended on geolocator plugin of baseflow.com
Want to contribute
If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), feel free to send your pull request.
Author
This easy_geofencing plugin for Flutter is developed by uzairleo.