Showing
3 changed files
with
11 additions
and
3 deletions
| 1 | import 'dart:convert'; | 1 | import 'dart:convert'; |
| 2 | 2 | ||
| 3 | +import 'package:android_id/android_id.dart'; | ||
| 3 | import 'package:auto_track/auto_track/config/queue.dart'; | 4 | import 'package:auto_track/auto_track/config/queue.dart'; |
| 4 | import 'package:crypto/crypto.dart'; | 5 | import 'package:crypto/crypto.dart'; |
| 5 | import 'package:device_info_plus/device_info_plus.dart'; | 6 | import 'package:device_info_plus/device_info_plus.dart'; |
| @@ -56,11 +57,16 @@ class AutoTrackConfigManager { | @@ -56,11 +57,16 @@ class AutoTrackConfigManager { | ||
| 56 | 57 | ||
| 57 | void _updateDeviceId() { | 58 | void _updateDeviceId() { |
| 58 | if (_baseDeviceInfo is IosDeviceInfo) { | 59 | if (_baseDeviceInfo is IosDeviceInfo) { |
| 59 | - _deviceId = md5.convert(utf8.encode('${(_baseDeviceInfo as IosDeviceInfo).identifierForVendor}#${config.appKey}')).toString(); | 60 | + _deviceId = md5 |
| 61 | + .convert(utf8.encode( | ||
| 62 | + '${(_baseDeviceInfo as IosDeviceInfo).identifierForVendor}#${config.appKey}')) | ||
| 63 | + .toString(); | ||
| 60 | } else if (_baseDeviceInfo is AndroidDeviceInfo) { | 64 | } else if (_baseDeviceInfo is AndroidDeviceInfo) { |
| 61 | - _deviceId = md5.convert(utf8.encode('${(_baseDeviceInfo as AndroidDeviceInfo).serialNumber}#${config.appKey}')).toString(); | 65 | + const AndroidId().getId().then((value) => _deviceId = |
| 66 | + md5.convert(utf8.encode('$value#${config.appKey}')).toString()); | ||
| 62 | } else if (_baseDeviceInfo is MacOsDeviceInfo) { | 67 | } else if (_baseDeviceInfo is MacOsDeviceInfo) { |
| 63 | - _deviceId = '${(_baseDeviceInfo as MacOsDeviceInfo).hostName}-${(_baseDeviceInfo as MacOsDeviceInfo).computerName}'; | 68 | + _deviceId = |
| 69 | + '${(_baseDeviceInfo as MacOsDeviceInfo).hostName}-${(_baseDeviceInfo as MacOsDeviceInfo).computerName}'; | ||
| 64 | } else { | 70 | } else { |
| 65 | _deviceId = null; | 71 | _deviceId = null; |
| 66 | } | 72 | } |
-
Please register or login to post a comment