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

パッケージ詳細v2.0.13

trust_location

Androidデバイス上の偽の場所を検出するためのFlutterプラグイン。

Android
30日間ダウンロード
360
いいね数
57
Pub ポイント
150

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

flutter pub add trust_location

パッケージ概要

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

TrustLocationは、Android上でデバイスの場所が偽装されているかどうかを検出することを目的としたFlutterプラグインです。開発者が、偽のGPSプロバイダーや変更された位置設定などの位置偽装の一般的な兆候をチェックすることで、位置データの信頼性を確認するのに役立ちます。乗車共有、フィットネストラッキング、セキュリティに敏感なサービスなど、正確な地理情報が必要なアプリケーションにおいて特に有用です。このプラグインはFlutterプロジェクトにシームレスに統合され、信頼性を判断するためにAndroid固有のシステムチェックに依存しています。

用途

  • ライドシェアリングアプリにおける偽のGPSの検出
  • フィットネストラッキングにおける正確な位置の確保
  • セキュリティアプリにおける位置のなりすましの防止
  • ジオフェンシングにおけるユーザーの位置の検証
  • 場所に基づく詐欺からの保護

主な機能

  • Android専用の位置偽装検出
  • モック場所設定の確認
  • 軽量で統合が簡単
  • ネイティブな Android API を使用します
  • 明確な信頼状態の結果を提供します

適している対象

  • 位置認識型Androidアプリを開発する開発者
  • 高精度の位置情報が必要なアプリ
  • セキュリティ重視のモバイルアプリケーション
  • ジオフェンシングまたは位置検証を使用するサービス

注意事項

  • Androidデバイスでのみ動作します
  • 適切な権限が必要です
  • すべてのスプーフィング手法を検出しない
  • プラットフォーム固有の実装に限定
  • ルート済みデバイスでは動作しない可能性があります

元の README

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

Trust Location

A Flutter plugin for detecting mock location on Android device. (Supports only high accuracy location mode) Please enable high accuracy in Android settings before using this plugin. Read more

Installation

Add trust_location as a dependency in your pubspec.yaml file

Permissions

Android

Add either the ACCESS_COARSE_LOCATION or the ACCESS_FINE_LOCATION permission to your Android Manifest. (located under android/app/src/main)

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

NOTE: This plugin uses the AndroidX version of the Android Support Libraries. Detailed instructions can be found here.

Usage

import 'package:trust_location/trust_location.dart';

/* Assuming in an async function */
/// query the current location.
LatLongPosition position = await TrustLocation.getLatLong;

/// check mock location on Android device.
bool isMockLocation = await TrustLocation.isMockLocation;

Using Stream.

// input seconds into parameter for getting location with repeating by timer.
// this example set to 5 seconds.
TrustLocation.start(5);

/// the stream getter where others can listen to.
TrustLocation.onChange.listen((values) =>
    print('${values.latitude} ${values.longitude} ${values.isMockLocation}')
);

/// stop repeating by timer
TrustLocation.stop();

Example

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:trust_location/trust_location.dart';

import 'package:location_permissions/location_permissions.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String? _latitude;
  String? _longitude;
  bool? _isMockLocation;

  /// initialize state.
  @override
  void initState() {
    super.initState();
    requestLocationPermission();
    // input seconds into parameter for getting location with repeating by timer.
    // this example set to 5 seconds.
    TrustLocation.start(5);
    getLocation();
  }

  /// get location method, use a try/catch PlatformException.
  Future<void> getLocation() async {
    try {
      TrustLocation.onChange.listen((values) => setState(() {
            _latitude = values.latitude;
            _longitude = values.longitude;
            _isMockLocation = values.isMockLocation;
          }));
    } on PlatformException catch (e) {
      print('PlatformException $e');
    }
  }

  /// request location permission at runtime.
  void requestLocationPermission() async {
    PermissionStatus permission =
        await LocationPermissions().requestPermissions();
    print('permissions: $permission');
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Trust Location Plugin'),
        ),
        body: Padding(
          padding: const EdgeInsets.all(20.0),
          child: Center(
              child: Column(
            children: <Widget>[
              Text('Mock Location: $_isMockLocation'),
              Text('Latitude: $_latitude, Longitude: $_longitude'),
            ],
          )),
        ),
      ),
    );
  }
}

Credit

Detecting the mock location: LocationAssistant

Issues

Please file any issues, bugs or feature request as an issue on our issues.

Contribute

If you would like to contribute to the plugin, send us your pull request.

License

This plugin is open source project and the license is BSD.

カテゴリー

ソースリポジトリ

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

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