搜尋套件、儲存庫與 APP 分類

套件詳情v0.4.0

unique_identifier

一個用於從 Android 和 iOS 取得唯一識別碼的新 Flutter 插件。

AndroidiOS
近 30 天下載
1.3萬
喜歡數
58
Pub 分數
140

安裝套件

flutter pub add unique_identifier

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

unique_identifier 套件是一個 Flutter 外掛程式,提供了一種簡單的方式來在 Android 與 iOS 平台上取得唯一的裝置識別碼。它利用原生 API 以確保可靠且安全的識別,適用於追蹤、授權或使用者驗證等用途。此外掛程式設計輕巧且易於整合,設定需求極少。它尊重平台特定的隱私指南,不會收集不必要的資料。此套件非常適合希望在跨平台環境中實現一致裝置識別,而不需直接管理原生程式碼的開發者。

適用情境

  • 設備追蹤
  • 應用授權
  • 使用者驗證
  • Analytics
  • 會話管理

主要特色

  • 跨平台支援(Android 與 iOS)
  • 簡單 API 結合
  • 尊重隱私指南
  • 無需額外權限
  • 安全標識符生成

適合對象

  • 行動應用開發者
  • 認證系統
  • 許可解決方案
  • 分析實施
  • 注重隱私的應用程式

使用建議

  • 識別碼可能在重新安裝應用後變更
  • 不適合高安全性加密
  • 依賴於平台特定的實作
  • 在某些地區可能需要使用者同意
  • 限於設備級別的唯一性

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Unique Identifier

pub package

A Flutter plugin to get the ANDROID_ID for android and identifierForVendor for iOS platforms.

Installing

dependencies:
  unique_identifier: ^0.4.0
Import
import 'package:unique_identifier/unique_identifier.dart';

How To Use

 dart String _identifier = 'Unknown';
  
 @override
 void initState() {
   super.initState();
   initUniqueIdentifierState();
 }

 Future<void> initUniqueIdentifierState() async {
   String identifier;
   try {
     identifier = await UniqueIdentifier.serial;
   } on PlatformException {
     identifier = 'Failed to get Unique Identifier';
   }

   if (!mounted) return;

   setState(() {
     _identifier = identifier;
   });
 }

 @override
 Widget build(BuildContext context) {
   return new MaterialApp(
     home: new Scaffold(
       appBar: new AppBar(
         title: const Text('Plugin example app'),
       ),
       body: new Center(
         child: new Text('Running on device with id: $_identifier\n'),
       ),
     ),
   );
 }

Bugs & Requests

If you encounter any bugs feel free to open an issue. Raise a ticket on github for suggestions. Pull request are also welcome.

Flutter

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

For help on editing plugin code, view the documentation.

License

MIT License

NOTE

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. Values of ANDROID_ID are scoped by signing key and user. The value may change if a factory reset is performed on the device or if an APK signing key changes. For more information about how the platform handles ANDROID_ID in Android 8.0 (API level 26) and higher, see Android 8.0 Behavior Changes. Note: For apps that were installed prior to updating the device to a version of Android 8.0 (API level 26) or higher, the value of ANDROID_ID changes if the app is uninstalled and then reinstalled after the OTA. To preserve values across uninstalls after an OTA to Android 8.0 or higher, developers can use Key/Value Backup. In versions of the platform lower than Android 8.0 (API level 26), a 64-bit number (expressed as a hexadecimal string) that is randomly generated when the user first sets up the device and should remain constant for the lifetime of the user's device. On devices that have multiple users, each user appears as a completely separate device, so the ANDROID_ID value is unique to each user. Note: If the caller is an Instant App the ID is scoped to the Instant App, it is generated when the Instant App is first installed and reset if the user clears the Instant App.

所屬分類

依賴

依賴清單 1 項

  • plugin_platform_interface^2.0.2

原始碼儲存庫

使用此套件的專案

暫無相關資料。