registerOnMobileCountryCodeChanged static method

void registerOnMobileCountryCodeChanged(
  1. void callback(
    1. int mobileCountryCode
    )
)

Register a callback invoked when the device mobile country code (MCC) changes.

This is useful for reacting to SIM/region changes on devices. The API is currently only supported on Android.

Parameters

  • callback: Function called with the new mobile country code (MCC) as an int.

Throws

Implementation

static void registerOnMobileCountryCodeChanged(
  void Function(int mobileCountryCode) callback,
) {
  if (!Platform.isAndroid) {
    throw PlatformException(
      code: 'PlatformNotSupported',
      message: 'The platform is not Android.',
    );
  }

  _onMobileCountryCodeChanged = callback;
}