パッケージ、リポジトリ、アプリカテゴリを検索

easy_geofencing のカバー
パッケージ詳細v0.2.0

easy_geofencing

これは、AndroidおよびiOSの両方で最適化されたジオフェンスバックグラウンドサービス機能を提供するDartパッケージです。

AndroidiOSWebmacOS
30日間ダウンロード
61
いいね数
61
Pub ポイント
125

パッケージをインストール

flutter pub add easy_geofencing

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

EasyGeofencing は、Android および iOS 用の最適化されたバックグラウンドジオフェンシングサービスを提供する Dart パッケージであり、Web および macOS もサポートしています。アプリがバックグラウンドで実行されている間でも、ユーザーが定義された領域に入ったり出たりしたときにイベントをトリガーできるようにします。ネイティブプラットフォーム機能との統合を簡素化し、効率的なバッテリー消費と信頼性の高い位置追跡を確保します。リアルタイムの位置ベースアプリケーション向けに設計されており、複数のプラットフォームでジオフェンスを管理するためのシンプルな API を提供します。

用途

  • リアルタイムでの位置追跡
  • 位置ベースの通知
  • アセットトラッキング
  • 配達および物流のモニタリング
  • ユーザーチェックインシステム

主な機能

  • クロスプラットフォーム対応(Android、iOS、Web、macOS)
  • 効率的なバックグラウンドジオフェンシング
  • 低電力消費
  • ジオフェンス管理のためのシンプルな API
  • リアルタイムの入室/退室イベント検出

適している対象

  • 位置認識を必要とするモバイルアプリ
  • 物流および配達サービス
  • フィットネスおよびアウトドアアクティビティアプリ
  • 小売およびマーケティングキャンペーン
  • スマートホームおよびIoT統合

注意事項

  • すべてのプラットフォームで場所の権限が必要です
  • バックグラウンド実行は、OSのポリシーによって異なる場合があります
  • バッテリー最適化の設定はパフォーマンスに影響する可能性があります
  • 一部のデバイスではジオフェンス半径の制限に制限される
  • 権限のリクエストとユーザーの同意を適切に処理する必要があります

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

EASY GEOFENCING

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

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

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:

  1. Add the following to your "gradle.properties" file:
android.useAndroidX=true
android.enableJetifier=true
  1. Make sure you set the compileSdkVersion in your "android/app/build.gradle" file to 30:
android {
  compileSdkVersion 30

  ...
}
  1. 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):

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

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):

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

FOR IOS

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
import 'package:easy_geofencing/easy_geofencing.dart';

EasyGeofencing.startGeofenceService(
    pointedLatitude: "34.2165157",
    pointedLongitude: "71.9437819",
    radiusMeter: "250.0",
    eventPeriodInSeconds: 5
);
GET GEOFENCE STATUS STREAMS

To get the stream geofence Status updates on location changes, you need to subscribe getGeofenceStream to listen geofence status streams on current location updates.

import 'package:easy_geofencing/easy_geofencing.dart';

StreamSubscription<GeofenceStatus> geofenceStatusStream = EasyGeofencing.getGeofenceStream().listen(
  (GeofenceStatus status) {
    print(status.toString());
});
Stop Geofence Service

To stop geofence service you need to specify this:

import 'package:easy_geofencing/easy_geofencing.dart';

EasyGeofencing.stopGeofenceService();

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.

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。