device_serial_number 0.0.1 copy "device_serial_number: ^0.0.1" to clipboard
device_serial_number: ^0.0.1 copied to clipboard

PlatformAndroid

Reads the device hardware serial number on Android, including SUNMI POS terminals.

device_serial_number #

Flutter plugin that reads the device hardware serial number on Android, including SUNMI POS terminals.

On most devices this uses Build.getSerial(). When that returns unknown (common on SUNMI hardware), the plugin falls back to OEM system properties such as ro.sunmi.serial and ro.serialno.

Installation #

Add to your pubspec.yaml:

dependencies:
  device_serial_number: ^0.0.1

Usage #

import 'package:device_serial_number/device_serial_number.dart';

final serial = await DeviceSerialNumber.getSerialNumber();

Returns null when the serial is unavailable or the platform is unsupported.

Android permissions #

On Android 8+ (API 26), READ_PHONE_STATE must be granted at runtime before Build.getSerial() succeeds. Add the permission to your app manifest and request it from your host app before calling this plugin.

<uses-permission android:name="android.permission.READ_PHONE_STATE" />

Platform support #

Platform Supported
Android Yes
iOS No

Example #

See the example/ app for a minimal integration.

0
likes
150
points
29
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Reads the device hardware serial number on Android, including SUNMI POS terminals.

Topics

#android #device-info #serial-number #sunmi #pos

License

MIT (license)

Dependencies

flutter

More

Packages that depend on device_serial_number

Packages that implement device_serial_number