Aus öffentlichen Paketdaten erstellte Orientierung.
Das android_id-Paket ist ein Flutter-Plugin, das Zugriff auf die Android-ID bietet, eine eindeutige Kennung, die jedem Android-Gerät zugewiesen wird. Speziell für Android entwickelt, ermöglicht es Entwicklern, diese ID für Zwecke wie Geräteverfolgung, Lizenzierung oder Analyse abzurufen. Das Plugin ist leichtgewichtig und lässt sich nahtlos in Flutter-Anwendungen für Android-Plattformen integrieren. Es unterstützt keine iOS- oder anderen Plattformen. Der Quellcode ist öffentlich auf GitHub verfügbar, um Transparenz zu gewährleisten und Beiträge zu ermöglichen.
Anwendungsfälle
Geräteidentifikation
App-Lizenzierung
Analyseverfolgung
Benutzer-Sitzungsverwaltung
Debugging und Testen
Hauptmerkmale
Einfaches API zum Abrufen der Android-ID
Nur für Android kompatibel
Open Source mit öffentlichem Repository
Minimale Abhängigkeiten
Sichere ID-Ermittlung
Geeignet für
Nur für Android verfügbare Apps
Gerätespezifische Funktionen
Lizenzsysteme
Analyseintegration
Hinweise
Nicht verfügbar auf iOS oder anderen Plattformen
Die Android-ID kann sich ändern, wenn das Gerät zurückgesetzt wird
Erforderliche Berechtigungen in AndroidManifest.xml
Eingeschränkte Verwendung für datenschutz-sensitive Anwendungen
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
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