Giter Site home page Giter Site logo

bestburning / platform_device_id Goto Github PK

View Code? Open in Web Editor NEW
70.0 2.0 137.0 325 KB

flutter plugin to get device id

Home Page: https://pub.dev/packages?q=platform_device_id

License: BSD 3-Clause "New" or "Revised" License

Kotlin 1.87% Go 3.02% Ruby 4.30% Swift 4.24% Objective-C 0.54% Dart 13.22% HTML 8.01% CMake 23.15% C 2.97% C++ 38.67%
deviceid go-flutter windows mac linux andorid ios id device

platform_device_id's Introduction

platform_device_id

get device id from android、ios、windows、linux、mac、web

Description

  • Windows

BIOS UUID e.g. 99A4D301-53F5-11CB-8CA0-9CA39A9E1F01

  • Linux

BIOS UUID e.g. 32a70060-2a39-437e-88e2-d68e6154de9f

  • Mac

IOPlatformUUID e.g. 02662E79-E342-521C-98EA-D4C18B61FEF3

  • Android

AndroidId e.g. 9774d56d682e549c

  • IOS

IdentifierForVendor e.g. 9C287922-EE26-4501-94B5-DDE6F83E1475

  • Web

UserAgent e.g. Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36

Getting Started

a simple usage example:

import 'package:platform_device_id/platform_device_id.dart';

String? deviceId = await PlatformDeviceId.getDeviceId;

Support Platform

  • Android
  • IOS
  • MacOS
  • Windows
  • Linux
  • Web

TODO

  • Support Dart Native platform device id
  • Web id change

Plugins Info

Plugin Pub Points Popularity Likes
platform_device_id pub package pub points popularity likes
platform_device_id_macos pub package pub points popularity likes
platform_device_id_linux pub package pub points popularity likes
platform_device_id_windows pub package pub points popularity likes
platform_device_id_web pub package pub points popularity likes

Go-flutter for windows/macos/linux

see here

platform_device_id's People

Contributors

bestburning avatar unger1984 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

platform_device_id's Issues

fix for go.mod in example

comment out the replace

update the version to v0.1.1

this now works:

module platform_device_id_example/go

go 1.14

require (
	github.com/BestBurning/platform_device_id/go v0.1.1
	github.com/go-flutter-desktop/go-flutter v0.38.0
	github.com/pkg/errors v0.9.1
)

//replace github.com/BestBurning/platform_device_id/go => D:\gitRepo\platform_device_id\go

Replace device_info with device_info_plus

Please consider replacing device_info pkg with device_info_plus pkg. As described on device_info page

This plugin has been replaced by the Flutter Community Plus Plugins version, device_info_plus. No further updates are planned to this plugin, and we encourage all users to migrate to the Plus version.
Critical fixes (e.g., for any security incidents) will be provided through the end of 2021, at which point this package will be marked as discontinued."

Android Build Error

Android Gradle Error due to the latest version used in the project. Package contains lower grade and kotlin version that is not supported to build with latest Gradle version.


* What went wrong:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher.
The following dependencies do not satisfy the required version:
project ':platform_device_id' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.3.8, on Microsoft Windows [Version 10.0.22621.819], locale en-IN)
Checking Android licenses is taking an unexpectedly long time...[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2021.3)
[√] VS Code (version 1.73.1)
[√] Connected device (4 available)
[√] HTTP Host Availability

! Doctor found issues in 1 category.

Better clarification of what is device id

I have read the readme but can't really understand what device id means.

Is it mac address? or some other unique id?.

I think it will be good to add clarification to the readme about what device id means, maybe even add a link to some source (like Wikipedia) that explains what it is because device id sounds to me really a general thing.

Get to the special characters on Windows platform

Getting a UUID on the Windows platform gets the newline character.

D:\MyData\xxxxx>wmic csproduct get uuid
UUID
5D1DC14B-754E-4797-AFEA-4237AA0F7018


D:\MyData\xxxxx>

So I will get the string contains \r\n\r\n. This causes the program to run incorrectly, so can the library handle the problem?

Link to repo is missing in pub.dev

Repository (GitHub) button exist in the right side:

image

Repository (GitHub) button is missing in the right side:

image

I saw that the Homepage button is linked to this repo but that functionality is more suited for Repository (GitHub) button.

Error on Linux

while checking on Ubuntu 20.04 getting below error

/sys/firmware/dmi/tables/smbios_entry_point: Permission denied
/dev/mem: Permission denied

platform_device_id does not work in pure Dart

I tried using this package on Windows in pure Dart and it does not work. Seeing that it works in flutter on windows, i believe with little modification, it should be able to work in pure dart on Windows.

Lost connection to device

When trying to get the device id from the windows desktop, a few seconds later it is crashing, and closing the application without showing any error log.

Currently my project is not null safety!

flutter doctor -v
[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [versão 10.0.19042.1083], locale pt-BR)
    • Flutter version 2.2.3 at C:\Users\progmaq02\Documents\src\flutter
    • Framework revision f4abaa0735 (2 weeks ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\progmaq02\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.9.3)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.9.31129.286
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 4.1.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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 1.8.0_242-release-1644-b01)

[√] VS Code, 64-bit edition (version 1.57.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.24.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [versão 10.0.19042.1083]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 91.0.4472.124
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 91.0.864.67

build fails on Mac

Hello,

I am trying to build my app on Mac for iOS but got number of errors on the plugin

"value witness table for Builtin.UnknownObject", referenced from:
full type metadata for platform_device_id.SwiftPlatformDeviceIdPlugin in libplatform_device_id.a(SwiftPlatformDeviceIdPlugin.o)
"_swift_FORCE_LOAD$_swiftCompatibilityDynamicReplacements", referenced from:
_swift_FORCE_LOAD$swiftCompatibilityDynamicReplacements$_platform_device_id in libplatform_device_id.a(SwiftPlatformDeviceIdPlugin.o)
(maybe you meant: _swift_FORCE_LOAD$swiftCompatibilityDynamicReplacements$_platform_device_id)
"_swift_FORCE_LOAD$_swiftCompatibility51", referenced from:
_swift_FORCE

__C.FlutterMethodChannel in libplatform_device_id.a(SwiftPlatformDeviceIdPlugin.o)
"_swift_FORCE_LOAD$_swiftCoreMedia", referenced from:
_swift_FORCE_LOAD$swiftCoreMedia$_platform_device_id in libplatform_device_id.a(SwiftPlatformDeviceIdPlugin.o)
(maybe you meant: _swift_FORCE_LOAD$swiftCoreMedia$platform_device_id)
"type metadata for Swift.String", referenced from:
platform_device_id.SwiftPlatformDeviceIdPlugin.handle(
: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libplatform_device_id.a(SwiftPlatformDeviceIdPlugin.o)
"swift_bridgeObjectRelease", referenced from:
@nonobjc __C.FlutterMethodChannel.__allocating_init(name: Swift.String, binaryMessenger: __C.FlutterBinaryMessenger) -> __C.FlutterMethodChannel in libplatform_device_id.a(SwiftPlatformDeviceIdPlugin.o)
platform_device_id.SwiftPlatformDeviceIdPlugin.handle(
: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libplatform_device_id.a(SwiftPlatformDeviceIdPlugin.o)
"Swift.String.init(builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String", referenced from:
static platform_device_id.SwiftPlatformDeviceIdPlugin.register(with: __C.FlutterPluginRegistrar) -> () in libplatform_device_id.a(SwiftPlatformDeviceIdPlugin.o)
platform_device_id.SwiftPlatformDeviceIdPlugin.handle(
: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libplatform_device_id.a(SwiftPlatformDeviceIdPlugin.o)

Works on Android
Thank you very much!

iOS pod install error

No podspec found for platform_device_id_v3 in .symlinks/plugins/platform_device_id_v3/ios
问题的原因是,你的项目名字是platform_device_id_v3,但是iOS文件下的podspec文件却是platform_device_id.podspec,文件里面的s.name 也是platform_device_id,所以在iOS平台上是跑不通的,我很好奇为啥这个问题,没人发现,大家都是用的安卓骂?

I need support

please I am a beginner I don't understand how to use this plugin. can you please put me through

Getting error if imports this package

Error is :

Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...

FAILURE: Build failed with an exception.

  • Where:
    Build file 'D:\Echo Switch\Flutter\Flutter Project\echo_switch\android\build.gradle' line: 11

  • What went wrong:
    A problem occurred evaluating root project 'android'.

Could not find method implementation() for arguments [org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.20] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 1s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

platform_device_id -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50

The package is not supported for the Latest Kotlin versions.

current configuration

  **
  platform_device_id: ^1.0.1
  **
buildscript {
    ext.kotlin_version = '1.7.10'
    repositories {
        google()
        mavenCentral()
    }
}

Error while building:

FAILURE: Build failed with an exception.

* What went wrong:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher.
The following dependencies do not satisfy the required version:
project ':platform_device_id' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 5s
Running Gradle task 'assembleRelease'...                            6.2s
Gradle task assembleRelease failed with exit code 1

Desktop implementations would be simplified

First of all, this is an amazing package. Thank you.

Just want to suggest something here: The desktop implementations would be simplified, just by calling the respective command line processes through dart:io Platform.run, like:

For linux, it would be:

var process = await Process.run(
    'dmidecode',
    ['-s', 'system-uuid'],
    mode: ProcessStartMode.normal,
    runInShell: true
  )
  .whenComplete(() => print('Completed')).catchError((error, stackTrace) {
    print('ERROR: $error');
  });
String systemUuid = '';
if (process.exitCode == 0) {
  systemUuid = utf8.decode(process.stdout);
}

I think it should work on windows, calling wmic csproduct get UUID and on MacOSX calling ioreg -l | grep IOPlatformUUID | awk 'NR==1{print $4}' | sed 's/\"//g'.

Maybe pipe operations would not work in Process.run call (i did not test it), but it can easily be handled on the Dart-side

Support for flutter 2.0

platform_device_id 0.1.3 currently depends on device_info ^1.0.0, it breaks the app if it is still stay in 1.0.0
it is suggested to update to device_info ^2.0.0 due to the newly released flutter 2.0

PlatformDeviceId.getDeviceId changes with the app release

Hello,
I supposed that PlatformDeviceId is a static ID connected to the device only. But strangely, I saw it changing after I installed an upgraded version of my apk app.
I was looking for an ID that depends on the hardware only, not randomly created. So far, I did try several device id libraries, and all give a pseudo-random ID which changes with a new application.
Therefore, I would ask, is this working as intended?
Thanks.

Failure in Ubuntu 20.04

Thank you for your plugin, however it does not work in Ubuntu
dmidecode -s system-uuid
/sys/firmware/dmi/tables/smbios_entry_point: Permission denied
/dev/mem: Permission denied

My fix is
if(buf[0] == 0) {
rstream = popen("cat /etc/machine-id", "r");
fread(buf, sizeof(char), sizeof(buf), rstream);
pclose(rstream);
}

[platform_device_id_platform_interface] Function is not implemented

/// Get the platform device id - [String]
Future<String?> getDeviceId() {
throw UnimplementedError('getDeviceId() has not been implemented.');

Not sure if you noticed but the function is not implemented. This means that your plugin runs well on Android but gives errors on IOS since it is not implemented.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.