Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get device IMEI in flutter

Tags:

flutter

dart

how can i get device IMEI in flutter i'm trying to get Unique Identifier using the following plugins:

uuid_type: ^0.7.0-dev
uuid: ^1.0.3
unique_identifier: ^0.0.3
flutter_udid: ^0.0.3 

all of them geting ID but not the same IMEI ID for device

and when i try to use device_info plugin from this example DeviceInfoPlugin i get error :

Multiple projects in this build have project

like image 240
Mahmoud Sabri Avatar asked Feb 20 '26 23:02

Mahmoud Sabri


2 Answers

The best way to get unique identifier ...

in Android: using unique_identifier to get IMEI

dev_dependencies:
   unique_identifier: ^0.0.3
String  identifier =await UniqueIdentifier.serial;

in IOS: Apple no longer allows you to retrieve the IMEI or any other device identification,but you can generate UDID using:

import 'package:device_info/device_info.dart';

final DeviceInfoPlugin deviceInfoPlugin = new DeviceInfoPlugin();
final data = await deviceInfoPlugin.iosInfo;
identifier = data.identifierForVendor;
like image 170
Mahmoud Sabri Avatar answered Feb 23 '26 12:02

Mahmoud Sabri


Android no longer allows you to access the IMEI or any other device identifier starting from android 10. Third party apps can not use IMEI & the serial number of a phone and other non-resettable device identifiers. So, now you can't access:

getSerial(),

getImei(),

getDeviceId(),

getSimSerialNumber(),

getSubscriberId()

You have to use another unique identifier for this like Android ID

Please refer: https://developer.android.com/preview/privacy/data-identifiers#device-ids

like image 23
master Gaurav Avatar answered Feb 23 '26 11:02

master Gaurav