android_id 패키지는 각 Android 기기마다 할당되는 고유 식별자인 Android ID에 대한 액세스를 제공하는 Flutter 플러그인입니다. Android 전용으로 설계되어, 장치 추적, 라이선싱 또는 분석과 같은 목적을 위해 이 ID를 검색할 수 있게 해줍니다. 가볍고 Android 플랫폼을 대상으로 한 Flutter 앱에 원활하게 통합됩니다. iOS 또는 기타 플랫폼은 지원하지 않습니다. 소스 코드는 투명성과 기여를 위해 GitHub에서 공개되어 있습니다.
사용 사례
장치 식별
앱 라이선스
분석 트래킹
사용자 세션 관리
디버깅 및 테스트
주요 기능
Android ID를 가져오는 간단한 API
안드로이드 전용 호환성
오픈소스, 공개 저장소
최소 종속성
보안 ID 검색
적합한 대상
Android 전용 앱
기기별 기능
라이선스 시스템
분석 통합
고려 사항
iOS 또는 기타 플랫폼에서 사용할 수 없습니다
장치를 재설정하면 Android ID가 변경될 수 있습니다
AndroidManifest.xml에 적절한 권한이 필요합니다
개인정보 보호에 민감한 애플리케이션용으로 제한된 사용
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
android_id
A Flutter plugin for retrieving the Android ID.
Getting started
Add plugin to pubspec.yaml
Use it in your code (see examples of all methods below)
Treat registration/runtime failures as null by wrapping the call in a try/catch:
const _androidIdPlugin = AndroidId();
String? androidId;
try {
androidId = await _androidIdPlugin.getId();
} onMissingPluginException {
print('Failed to get Android ID: MissingPluginException');
androidId = null;
} onPlatformExceptioncatch (e) {
print('Failed to get Android ID: ${e.message}');
androidId = null;
}
Note:getId() returns null on non-Android platforms (iOS, Web, etc.). On Android, it throws MissingPluginException if the plugin is not properly registered (see more below).
Important
Please note that on Android 8 and above, the Android ID is not unique per device, but also per signing key the app was built with:
On Android 8.0 (API level 26) and higher versions of the platform, a 64-bit number (expressed as a hexadecimal string), unique to each combination of app-signing key, user, and device.
The value may change if a factory reset is performed on the device or if an APK signing key changes.
Before using this plugin in your app, make sure to follow Google Play guidelines.
For example here:
Persistent identifiers, including Android ID
Use for non-advertising purposes
You can use persistent identifiers as long as you have a privacy policy and handle the data in accordance with the Developer Distribution Agreement and all applicable privacy laws in the areas where you make your app available.
Android build compatibility
android_id supports Android Gradle Plugin 9 and Flutter's built-in Kotlin mode.
It also keeps working with AGP 8 and Flutter's temporary
android.builtInKotlin=false opt-out.
The plugin no longer provides its own Android Gradle Plugin or Kotlin Gradle
Plugin classpaths. It only applies the Kotlin Gradle Plugin when the host build
still needs it. This fixes errors such as:
The 'org.jetbrains.kotlin.android' plugin is no longer required for Kotlin
support since AGP 9.0.
Most Flutter apps should not need app-code changes.
Troubleshooting
If you're experiencing MissingPluginException, try these steps in order:
Full Rebuild: Stop the app completely and rebuild from scratch
flutter clean
flutter pub get
flutter run
Check Flutter Version: Ensure you're using Flutter 3.10.0 or higher