I want to get a device id or any unique number that can not be changed when someone uninstalls the app. This device is for both android and iOS and is in the flutter framework. I want this to manage my device management.
Thanks for the help.
I tried some of the most commonly used packages in flutter like device_info_plus and flutter_udid but IDs generated from these changes every day.
2
Answers
Did you tried platform_device_id
This package can help you to get deviceId in android, iOS, windows, macOS and even in web and linux.
After importing the package you need to use following code
You can use @Rohan’s answer also.
platform_device_id
package. Read moreThere is guide for
device_info_plus
package Read moreadd package to your flutter project.
Create a method like this:
use it like this:
Note (updateded):
Don’t use
androidDeviceInfo.androidId
. This would change when your mac address changes. Mobile devices aboveAndroid OS 10/11
will generate a randomized MAC. This feature is enabled by default unless disabled manually. This would cause theandroidId
to change when switiching networks. You can confirm this by yourself by changingandroidDeviceInfo.id
toandroidDeviceInfo.androidId
above.(Got details from @Ariel)