getAdId static method

Future<String?> getAdId()

获取adID(区分安卓和iOS)

Implementation

static Future<String?> getAdId() async {
  try {
    if (Platform.isAndroid) {
      String? adId = await deviceIdentifier.getAdvertisingIdForAndroid();
      return adId;
    }
    if (Platform.isIOS) {
      String? adId = await deviceIdentifier.getAdvertisingIdForiOS();
      return adId;
    }
    return null;
  } catch (e, stackTrace) {
    StormyLog.e(
      'AppUtils.getAdId: 获取AdId失败',
      stackTrace: stackTrace,
      extra: {'error': e.toString()},
    );
    return null;
  }
}