1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-22 11:42:46 +01:00
immich/mobile/lib/shared/services/device_info.service.dart
Alex c624580596
Bugfix/persistent UUID (#46)
* UUID is now persisted between reinstallation
2022-03-11 13:38:52 -06:00

29 lines
780 B
Dart

import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter_udid/flutter_udid.dart';
import 'package:flutter/material.dart';
class DeviceInfoService {
Future<Map<String, dynamic>> getDeviceInfo() async {
// Get device info
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
String? deviceId = "";
String deviceType = "";
try {
deviceId = await FlutterUdid.consistentUdid;
deviceType = "ANDROID";
} catch (e) {
debugPrint("Not an android device");
}
try {
deviceId = await FlutterUdid.consistentUdid;
deviceType = "IOS";
debugPrint("Device ID: $deviceId");
} catch (e) {
debugPrint("Not an ios device");
}
return {"deviceId": deviceId, "deviceType": deviceType};
}
}