搜索插件、代码仓与 APP 分类

插件详情v4.2.0

flutter_udid

用于在 iOS 和 Android 上跨重新安装获取持久性 UDID 的插件

AndroidiOSmacOSWindowsLinux
近 30 天下载
14.4万
喜欢数
290
Pub 分数
160

安装插件

flutter pub add flutter_udid

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

flutter_udid 是一个 Flutter 插件,可在 Android、iOS、macOS、Windows 和 Linux 上提供跨应用重新安装的持久唯一设备标识符(UDID)。它安全地生成并存储与设备绑定的一致 ID,有助于在不依赖临时或易失性标识符的情况下追踪用户设备。该插件利用平台特定机制确保可靠性和隐私合规性。在需要长期设备识别的场景中特别有用,例如许可管理、分析或反欺诈系统。源代码公开托管在 GitHub 上,以保证透明度和可定制性。

适合场景

  • 设备在应用重新安装后的追踪
  • 许可和激活系统
  • 用户分析和归因
  • 反欺诈和安全监控

主要特点

  • 应用重新安装后仍保持持久
  • 跨平台支持(Android、iOS、macOS、Windows、Linux)
  • 设备ID的安全存储
  • 使用原生平台机制
  • 开源且透明

适合对象

  • 需要长期设备识别的应用
  • 安全敏感的应用程序
  • 分析和许可平台
  • 注重隐私和合规性的开发者

使用建议

  • 需要在 Android 和 iOS 上具有适当的权限
  • 如果被滥用,可能会引发隐私问题
  • 不适合直接用于识别用户
  • 依赖于平台级别的持久化机制
  • 应与用户同意和透明度一起使用

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

flutter_udid

pub package

Plugin to retrieve a persistent UDID across app reinstalls on iOS, Android, Mac, Windows & Linux.

Usage

import 'package:flutter_udid/flutter_udid.dart';

String udid = await FlutterUdid.udid;

This provides an UDID using the format of the corresponding platform.

Platform IDs

Platform Format Source
iOS 7946DA4E-8429-423C-B405-B3FC77914E3E identifierForVendor, saved to Keychain for persistence
Android 8af8770a27cfd182 Settings.Secure.ANDROID_ID
Mac 707E990C-D002-520B-ABA6-4216C6D514BF kIOPlatformUUIDKey
Windows 99A4D301-53F5-11CB-8CA0-9CA39A9E1F01 BIOS UUID
Linux 1124435e065241dcae2241e9caab9a6c Machine ID
iOS Keychain Availability

On iOS, the UDID is stored in Keychain with kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly. This means it is available only after the user has unlocked the device once after reboot, including later background launches while the device is locked. Before the first unlock after reboot, requesting the UDID throws a PlatformException.

Consistent Format

To get a consistent formatting on all platforms use:

import 'package:flutter_udid/flutter_udid.dart';

String udid = await FlutterUdid.consistentUdid;

This will result in an UDID of the following format:

984725b6c4f55963cc52fca0f943f9a8060b1c71900d542c79669b6dc718a64b

Persistence Notes

The UDID can change after a factory reset!

Additionally, if a device has been updated to Android 8.0 through an OTA and the app is reinstalled, the UDID may change as well due to security changes in Android 8.0.

On rooted and jailbroken devices the ID can be changed, so please take this into account. However, it should not be possible to identify as a different device through random guessing because of the complexity of the ID.

Furthermore, the UDID may also change if there is a change in the app's signing signature, for both iOS and Android. Ensure that you always use the same digital signature to sign your app.

Flutter Resources

For help getting started with Flutter, view the online documentation.

For help on editing plugin code, view the documentation.

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目