Home > Mobile >  Flutter Same Device ID on Different Devices
Flutter Same Device ID on Different Devices

Time:11-22

I'm using device_info_plus library for Device uniqid. Everything working fine till.

But now I'm facing weird issue.

  1. All device id has been changed. Like first they are getting as 240a75fXXXXXXXXX like this. Now they are getting as RKQ1.21XXXXXX.XXX like this.
  2. Also same device id founded on different device. Same device id has been get from 5 different device.

This is issue is only on Android Devices. Everything working fine on iOS. I'm using

device_info_plus: ^8.0.0
await _deviceInfo.androidInfo.then((value) {
      device_imeino = value.id;
    });

Whats wrong??

CodePudding user response:

You can try out with this code :

device_info_plus: ^3.2.1

String? deviceId = '';

getDeviceID() async {
    final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
    if (Platform.isAndroid) {
      AndroidDeviceInfo androidInfo = await deviceInfoPlugin.androidInfo;
      deviceId = androidInfo.androidId ?? '';
    } else if (Platform.isIOS) {
      IosDeviceInfo iosInfo = await deviceInfoPlugin.iosInfo;
      deviceId = iosInfo.identifierForVendor ?? '';
    }
  }

CodePudding user response:

androidID is removed from device_info_plus since v4.1.0. Check the changelog.

android_id package is recommanded to get the correct androidId.

  • Related