Skip to content

Commit

Permalink
Show correct device type when registering new device
Browse files Browse the repository at this point in the history
  • Loading branch information
alextran1502 committed Mar 11, 2022
1 parent c624580 commit e13d4a6
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions mobile/lib/shared/services/device_info.service.dart
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter_udid/flutter_udid.dart';
import 'package:flutter/material.dart';
import 'dart:io' show Platform;

class DeviceInfoService {
Future<Map<String, dynamic>> getDeviceInfo() async {
// Get device info
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
String? deviceId = "";
String deviceId = await FlutterUdid.consistentUdid;
String deviceType = "";

try {
deviceId = await FlutterUdid.consistentUdid;
if (Platform.isAndroid) {
deviceType = "ANDROID";
} catch (e) {
debugPrint("Not an android device");
}

try {
deviceId = await FlutterUdid.consistentUdid;
} else if (Platform.isIOS) {
deviceType = "IOS";
debugPrint("Device ID: $deviceId");
} catch (e) {
debugPrint("Not an ios device");
}

return {"deviceId": deviceId, "deviceType": deviceType};
Expand Down

0 comments on commit e13d4a6

Please sign in to comment.