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

パッケージ詳細v0.1.1

flutter_sensor_compass

デバイスの磁気北極に対する方位(度単位)を取得するプラグイン。

30日間ダウンロード
27
いいね数
3
Pub ポイント
40

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

flutter pub add flutter_sensor_compass

パッケージ概要

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

flutter_sensor_compass パッケージは、デバイスのコンパスセンサーに簡単にアクセスできるようにし、磁北を基準としたリアルタイムの方位データ(度単位)を提供します。アプリがデバイスの向きを検出できるため、ナビゲーションや拡張現実、位置情報ベースのサービスに最適です。このプラグインは、デバイス内蔵のマグネトメーターを利用しており、Flutterアプリへのシームレスな統合を目的としています。バックグラウンド更新をサポートし、最小限の構成で正確な読み取り値を提供します。開発者は簡単に方位変化を購読し、それに応じて反応できます。

用途

  • ナビゲーションアプリ
  • 拡張現実体験
  • 場所ベースのゲーム
  • 屋外活動のトラッキング
  • 地図の方位

主な機能

  • リアルタイムコンパスデータ
  • 磁北の向き
  • バックグラウンドセンサーの更新
  • シンプルなAPI統合
  • クロスプラットフォーム対応

適している対象

  • ナビゲーションツールを開発する開発者
  • デバイスの方向センシングを必要とするアプリ
  • ARおよびVRアプリケーション
  • フィットネスおよびアウトドアトラッキングアプリ

注意事項

  • マグネトメーターを搭載したデバイスが必要です
  • 正確性のためにキャリブレーションが必要になる場合があります
  • センサーのないデバイスでは制限される
  • 継続的なポーリングによるバッテリー消費
  • 近接する磁気干渉により精度が影響を受ける

元の README

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

flutter_sensor_compass

A plugin to get the orientation of the device (in degrees) relative to the magnetic north.

Installation

First add the plugin in your project. Copy the following line below dependencies in your pubspec.yaml file.

dependencies:
     ...
    flutter_sensor_compass: ^0.1.1

Then you need to import the dependency.

import 'package:flutter_sensor_compass/flutter_sensor_compass.dart';
iOS only

You need to add the following key-value pair into your Info.plist file inside the ios/Runner folder in your project.

<key>NSMotionUsageDescription</key>
<string>A reason to get the permission</string>

How to use

You can check if the device is capable of using the compass.

bool isAvailable = await Compass().isCompassAvailable();

Then you can register a new listener for the compass updates.

_compassSubscription =
        Compass().compassUpdates(interval: Duration(milliseconds: 200)).listen((value) {
      setState(() {
        _degrees = value;
      });
    });

Remember to cancel your StreamSubscriptions after you are done with the compass updates.

_compassSubscription.cancel();

カテゴリー

依存関係

依存関係一覧 2 件

ソースリポジトリ

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

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