Home > front end >  How can I get any unique id flutter android and ios
How can I get any unique id flutter android and ios

Time:09-19

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?

CodePudding user response:

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;

CodePudding user response:

device_info_plus

identifierForVendor for ios.
androidId for android

You can control with Platform.ios condition.

In addition, you can store with secure_storage

CodePudding user response:

The token is generated per the client app instance.

On initial startup of your app, the FCM SDK generates a registration token for 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.

  • Related