fluttercommunity / plus_plugins

Flutter Community Plus Plugins
BSD 3-Clause "New" or "Revised" License
1.56k stars 946 forks source link

[Bug]: device_info_plus can't return unique identification code #934

Closed guo7940 closed 2 years ago

guo7940 commented 2 years ago

Platform

iOS 15.5, android 12

Plugin

device_info_plus

Version

4.0.0

Flutter SDK

2.10.5

Steps to reproduce

Remove and install repeatedly to obtain unique identification code. androidId return empty string. iOS identifierForVendor Every return is different

Code Sample

final devInfo = DeviceInfoPlugin();
String id = '';
if (!kIsWeb && Platform.isAndroid) {
  AndroidDeviceInfo deviceInfo = await devInfo.androidInfo;
  id = deviceInfo.androidId ?? '';
} else if (!kIsWeb && Platform.isIOS) {
  IosDeviceInfo deviceInfo = await devInfo.iosInfo;
  id = deviceInfo.identifierForVendor ?? '';
}

Logs

[ +131 ms] executing: sysctl hw.optional.arm64
[  +29 ms] Exit code 0 from: sysctl hw.optional.arm64
[   +2 ms] hw.optional.arm64: 1
[   +7 ms] executing: [/Applications/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[  +15 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] 5464c5bac742001448fe4fc0597be939379f88ea
[   +1 ms] executing: [/Applications/flutter/] git tag --points-at 5464c5bac742001448fe4fc0597be939379f88ea
[  +24 ms] Exit code 0 from: git tag --points-at 5464c5bac742001448fe4fc0597be939379f88ea
[        ] 2.10.5
[  +12 ms] executing: [/Applications/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +12 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [/Applications/flutter/] git ls-remote --get-url origin
[  +11 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[ +160 ms] executing: [/Applications/flutter/] git rev-parse --abbrev-ref HEAD
[  +18 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[   +7 ms] executing: sw_vers -productName
[  +20 ms] Exit code 0 from: sw_vers -productName
[        ] macOS
[        ] executing: sw_vers -productVersion
[  +21 ms] Exit code 0 from: sw_vers -productVersion
[        ] 12.3
[        ] executing: sw_vers -buildVersion
[  +18 ms] Exit code 0 from: sw_vers -buildVersion
[   +1 ms] 21E230
[  +65 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +2 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +51 ms] executing: /Users/shiqingguo/Library/Android/sdk/platform-tools/adb devices -l
[  +19 ms] executing: sysctl hw.optional.arm64
[  +11 ms] Exit code 0 from: sysctl hw.optional.arm64
[        ] hw.optional.arm64: 1
[        ] executing: /usr/bin/arch -arm64e xcrun xcodebuild -version
[  +92 ms] Exit code 0 from: /usr/bin/arch -arm64e xcrun xcodebuild -version
[        ] Xcode 13.4.1
           Build version 13F100
[   +4 ms] executing: /usr/bin/arch -arm64e xcrun xcdevice list --timeout 2
[   +4 ms] /usr/bin/arch -arm64e xcrun simctl list --json devices
[        ] executing: /usr/bin/arch -arm64e xcrun simctl list --json devices
[   +4 ms] executing: /usr/bin/arch -arm64e xcrun simctl list
[  +82 ms] Exit code 0 from: /usr/bin/arch -arm64e xcrun simctl list
[   +1 ms] == Device Types ==
           iPhone 4s (com.apple.CoreSimulator.SimDeviceType.iPhone-4s)
           iPhone 5 (com.apple.CoreSimulator.SimDeviceType.iPhone-5)
           iPhone 5s (com.apple.CoreSimulator.SimDeviceType.iPhone-5s)
           iPhone 6 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-6-Plus)
           iPhone 6 (com.apple.CoreSimulator.SimDeviceType.iPhone-6)
           iPhone 6s (com.apple.CoreSimulator.SimDeviceType.iPhone-6s)
           iPhone 6s Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-6s-Plus)
           iPhone SE (1st generation) (com.apple.CoreSimulator.SimDeviceType.iPhone-SE)
           iPhone 7 (com.apple.CoreSimulator.SimDeviceType.iPhone-7)
           iPhone 7 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-7-Plus)
           iPhone 8 (com.apple.CoreSimulator.SimDeviceType.iPhone-8)
           iPhone 8 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-8-Plus)
           iPhone X (com.apple.CoreSimulator.SimDeviceType.iPhone-X)
           iPhone Xs (com.apple.CoreSimulator.SimDeviceType.iPhone-XS)
           iPhone Xs Max (com.apple.CoreSimulator.SimDeviceType.iPhone-XS-Max)

Flutter Doctor

[✓] Flutter (Channel stable, 2.10.5, on macOS 12.3 21E230 darwin-arm, locale zh-Hans-CN)
    • Flutter version 2.10.5 at /Applications/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5464c5bac7 (10 weeks ago), 2022-04-18 09:55:37 -0700
    • Engine revision 57d3bac3dd
    • Dart version 2.16.2
    • DevTools version 2.9.2
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/shiqingguo/Library/Android/sdk
    • Platform android-31, build-tools 29.0.2
    • ANDROID_SDK_ROOT = /Users/shiqingguo/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[✓] VS Code (version 1.68.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.42.0

[✓] Connected device (4 available)
    • M2102J2SC (mobile)      • b87f4a9e                             • android-arm64  • Android 11 (API 30)
    • shiqing的iPhone (mobile) • 00008110-000825EE1E87801E            • ios            • iOS 15.5 19F77
    • iPhone 13 (mobile)      • 2F0A4468-6AA8-4F16-89F6-69D48C65F7BF • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-5 (simulator)
    • Chrome (web)            • chrome                               • web-javascript • Google Chrome 102.0.5005.115
    ! Error: shiqing的iPhone is busy: Preparing the watch for development via shiqing的iPhone. Xcode will continue when shiqing的iPhone is finished. (code -10)

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
hkpatel201 commented 2 years ago

Have same issue in android as well.

androidId: null,

Mohammed1907s commented 2 years ago

Have same issue in android as well.

androidId: null,

Komche commented 2 years ago

Have same issue in android as well.

androidId: null,

I have the same issue too. Any one have a solution ?

harguus commented 2 years ago

According to the Changelog, the AndroidId method has been removed... https://pub.dev/packages/device_info_plus/changelog

alexmaycon commented 2 years ago

Have same issue in android as well. androidId: null,

I have the same issue too. Any one have a solution ?

I started to generate a unique identification (Uuid) and save it in the device's SharedPreferences and use this Uuid to identify it.

https://pub.dev/packages/uuid

Android important article: https://developer.android.com/training/articles/user-data-ids

popsams commented 2 years ago

Have same issue in android as well.

androidId: null,

me too

Somtobro commented 2 years ago

I can't believe this!

frank2359 commented 2 years ago

According this document: https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor#1965828 I think It is not a bug.

Somtobro commented 2 years ago

I know it's not a bug I was suggesting device info plus return the unique id code

Most apps depend on this already I have 2 published apps and my means of identification is the unique id

Besides, playstore recognizes unique id last I checked You just need to state in the privacy policy And they are other ways to make users safer eg encrypting the id before display that way we get a fake....as long as it's unique

Removing it is not smart....my opinion Nice package tho

On Thu, Jul 14, 2022, 5:03 AM frank2359 @.***> wrote:

According this document: https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor#1965828 I think It is not a bug.

— Reply to this email directly, view it on GitHub https://github.com/fluttercommunity/plus_plugins/issues/934#issuecomment-1183960874, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWI5F3Y6P5WJ2FEO4JDGFUDVT6GSLANCNFSM5Z5BFEIA . You are receiving this because you commented.Message ID: @.***>

popsams commented 2 years ago

I know it's not a bug I was suggesting device info plus return the unique id code Most apps depend on this already I have 2 published apps and my means of identification is the unique id Besides, playstore recognizes unique id last I checked You just need to state in the privacy policy And they are other ways to make users safer eg encrypting the id before display that way we get a fake....as long as it's unique Removing it is not smart....my opinion Nice package tho On Thu, Jul 14, 2022, 5:03 AM frank2359 @.> wrote: According this document: https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor#1965828 I think It is not a bug. — Reply to this email directly, view it on GitHub <#934 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWI5F3Y6P5WJ2FEO4JDGFUDVT6GSLANCNFSM5Z5BFEIA . You are receiving this because you commented.Message ID: @.>

I agree

nohli commented 2 years ago

FYI there is a new plugin for getting the Android ID 🙂 https://pub.dev/packages/android_id

brunobmorais commented 2 years ago

From Android 10 onwards it is restrict to collect unique identifiers. This was achieved only in DeviceOwner privileged apps and system apps. From android developer documentation Best practices for unique identifiers explained how to identify uniqueness based on different scenerios. Link