Reputation: 11
As i have used device_info_plus package to my flutter application to get id of the mobile device but the device id chaged for the same application in some device Why it is changed and also is there any other dependency or fuction to get the unique device id
void checkImeiOnAndroid(String apiImei) async {
isImeiMatched = true;
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
String? deviceImei = androidInfo.id;
isImeiMatched = (deviceImei == apiImei);
notifyListeners();
}
void checkDeviceIdOnIOS(String apiDeviceId) async {
isDeviceIdMatched = true;
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
String deviceId = iosInfo.identifierForVendor ?? "Safari";
isDeviceIdMatched = (deviceId == apiDeviceId);
notifyListeners();
}
apiImei/apiDeviceId is got from the database where i am storing the unique device id and wants to match it with the device id
Upvotes: 0
Views: 39
Reputation: 50
Why is the Device ID Changing?
1️⃣ Android (androidInfo.id changing)
androidInfo.id is NOT a unique hardware identifier.
On some devices, this ID may change when:
The device is factory reset.
A new user profile is created on the device.
Some Android OEMs (Samsung, Xiaomi, etc.) generate different IDs after system updates.
2️⃣ iOS (iosInfo.identifierForVendor changing)
identifierForVendor is unique per app and per vendor (same developer account).
The ID changes when:
The user uninstalls and reinstalls the app.
The app is installed on another device.
The app is installed from a different Apple Developer account (TestFlight vs App Store).
You have some solutions:
package: mobile_device_identifier
or
Upvotes: -1