I need to get a unique information of my device. This may be the mac address, it may be the imei address, or something different, ios and android return a constant value after a certain version and do not give the unique id.
The unique id as currently used changes when the application is deleted and reinstalled. I have a chat system and I don’t want some members to come back.
Is there a way to access a device’s unique information by obtaining a permission if necessary?
2
Answers
you can use a package called firebase_messaging and get device token
String deviceToken = await FirebaseMessaging.instance.getToken();
To get the IMEI of user phone device_information
String imeiNo = await DeviceInformation.deviceIMEINumber;
The token is generated per the client app instance.
See Best practices for FCM registration token management for details.
Only one user at the time is logged in on the app instance. Delete the token when a user logs out and then you get a new token when a new user logs in.