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

패키지 상세v2.0.13

trust_location

안드로이드 기기에서 가짜 위치를 감지하기 위한 플러터 플러그인입니다.

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.

카테고리

소스 저장소

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

아직 데이터가 없습니다.