TheMortiestMorty
TheMortiestMorty

Reputation: 705

Flutter: How do I get the serial number of the device?

I'm using Flutter and the device_info_plus package. I made sure to add this permission in the manifest, but it still doesn't work:

<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"
        tools:ignore="ProtectedPermissions" /> 

The code:

final deviceInfoPlugin = DeviceInfoPlugin();
final deviceInfo = await deviceInfoPlugin.deviceInfo;
final serialNumber = deviceInfo.data['serialNumber']; //Returns "unknown"

Upvotes: 3

Views: 2336

Answers (0)

Related Questions