safe_device 패키지는 앱이 iOS 시뮬레이터, 안드로이드 에뮬레이터 또는 디버그 모드와 같은 시뮬레이션 환경에서 실행되고 있는지 여부를 개발자가 감지하는 데 도움을 줍니다. 또한 안드로이드 기기에서 위조된 GPS 위치를 식별하고 기기가 진짜인지 여부를 판단합니다. 이는 시뮬레이션되거나 위조된 환경에서의 무단 접근을 방지함으로써 보안을 강화합니다. 금융이나 민감한 데이터 관련 상황에서 강력한 장치 무결성 검사를 필요로 하는 애플리케이션에 유용합니다.
사용 사례
에뮬레이터 사용에 대비한 앱 보안
가짜 GPS 위치 감지
디버그 모드 악용 방지
실제 장치 존재 검증
사기 탐지 향상
민감한 데이터 액세스 보호
주요 기능
iOS 시뮬레이터 감지
Android 에뮬레이터 식별
디버그 모드 확인
위조 위치/가짜 GPS 감지
장치의 진위를 확인합니다
경량이며 플랫폼에 관계없이 사용 가능
적합한 대상
보안 중심 애플리케이션
금융 또는 은행 앱
사기 방지 시스템
장치 무결성 요구 앱
런타임 안정성을 우선시하는 개발자
고보안 요구 사항을 가진 모바일 앱
고려 사항
Android 및 iOS 플랫폼에 한정
모든 형태의 스푸핑을 방지하지 않습니다
장치 고유의 지표에 의존합니다
루트된 장치에서 잘못된 긍정 결과를 유발할 수 있습니다
Android에서 올바른 권한 처리가 필요합니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
safe_device (Null-Safety)
Flutter (Null-Safety) Jailbroken, root, emulator and mock location detection.
Getting Started
In your flutter project add the dependency:
dependencies:...safe_device:^1.4.1
Usage
Importing package
import'package:safe_device/safe_device.dart';
Configuration
You can configure the plugin at startup using SafeDevice.init and SafeDeviceConfig. This is useful if you want to disable automatic check such as the mock location detection.
import'package:safe_device/safe_device.dart';
import'package:safe_device/safe_device_config.dart';
voidmain() async {
SafeDevice.init(
SafeDeviceConfig(mockLocationCheckEnabled: false), // disables mock location check on Android
);
// ...rest of your app
}
It's not mandatory to configure the plugin at the start, if not provided a default configuration with everything enable is provided automatically
Using it
Checks whether device JailBroken on iOS/Android?
bool isJailBroken = awaitSafeDevice.isJailBroken;
(iOS ONLY) Enhanced jailbreak detection with custom path checking
Android: If mock location check is disabled via config, the check always returns false and no location updates are started. If enabled (default), the check is active.
iOS: The config is stored for future use but does not affect current detection logic. Mock location detection on iOS is based on jailbreak/emulator status.
(ANDROID ONLY) Check if application is running on external storage
Detects a wide range of Android emulators including:
Android SDK Emulator, Genymotion
LDPlayer, MEmu, BlueStacks, MuMu Player (NetEase), Nox, Droid4X
Known Limitations
Root and jailbreak detection is a best-effort approach. A determined attacker using tools such as Magisk Hide or Zygisk can bypass detection. This plugin is intended as a security layer — not a guarantee.
Device-specific handling: Some manufacturers (Samsung, Xiaomi, Vivo) ship with system properties or Knox security components that can cause false positives. The plugin applies conservative multi-indicator checks for these brands to balance accuracy and reliability.
Notes
Mock location detection
Android — Location permission is required to detect mock location. The check can be disabled at runtime via config.
iOS — Mock location detection is based on jailbreak/emulator status.
Development Mode
Development Options in emulator is always true by default.
❗Since emulators are usually rooted, you might want to bypass these checks during development. Unless you're keen on constant false alarms ⏰