import 'dart:io';

import 'package:device_info_plus/device_info_plus.dart';
import 'package:android_id/android_id.dart';
import 'package:oaid/oaid_kit.dart';
// import 'package:oaid/oaid_kit.dart';
import '../utils/atmob_log.dart';
import 'atmob_platform_info.dart';

class PlatformAndroidInfo {
  static Future<void> init() async {
    if (Platform.isAndroid) {
      DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
      AndroidDeviceInfo androidInfo = await deviceInfoPlugin.androidInfo;
      String? deviceId = await const AndroidId().getId();
      atmobPlatformInfo
          .setAndroidId(deviceId)
          .setBrand(androidInfo.brand)
          .setModel(androidInfo.model);
      Oaid.getOaid().then((oaid) {
        atmobPlatformInfo.setOaid(oaid);
      }).catchError((error) {
        AtmobLog.d('oaid', error.toString());
      });
    }
  }
}
