mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
Transfer repository from Gitlab
This commit is contained in:
parent
af2efbdbbd
commit
568cc243f0
177 changed files with 13300 additions and 0 deletions
30
mobile/lib/shared/services/device_info.service.dart
Normal file
30
mobile/lib/shared/services/device_info.service.dart
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import 'package:device_info_plus/device_info_plus.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 {
|
||||
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
|
||||
deviceId = androidInfo.androidId;
|
||||
deviceType = "ANDROID";
|
||||
} catch (e) {
|
||||
debugPrint("Not an android device");
|
||||
}
|
||||
|
||||
try {
|
||||
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
|
||||
deviceId = iosInfo.identifierForVendor;
|
||||
deviceType = "IOS";
|
||||
debugPrint("Device ID: $deviceId");
|
||||
} catch (e) {
|
||||
debugPrint("Not an ios device");
|
||||
}
|
||||
|
||||
return {"deviceId": deviceId, "deviceType": deviceType};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue