checkServiceStatus method

  1. @override
Future<ServiceStatus> checkServiceStatus(
  1. Permission permission
)
override

Checks the current status of the service associated with the given Permission.

Notes about specific permissions:

  • Permission.phone
    • Android:
      • The method will return ServiceStatus.notApplicable when:
        • the device lacks the TELEPHONY feature
        • TelephonyManager.getPhoneType() returns PHONE_TYPE_NONE
        • when no Intents can be resolved to handle the tel: scheme
      • The method will return ServiceStatus.disabled when:
        • the SIM card is missing
    • iOS:
      • The method will return ServiceStatus.notApplicable when:
        • the native code can not find a handler for the tel: scheme
      • The method will return ServiceStatus.disabled when:
    • PLEASE NOTE that this is still not a perfect indication of the device's capability to place & connect phone calls as it also depends on the network condition.

Implementation

@override
Future<ServiceStatus> checkServiceStatus(Permission permission) async {
  final result = await checkPermissionStatus(permission);
  switch (result) {
    case PermissionStatus.granted:
      return ServiceStatus.enabled;
    default:
      return ServiceStatus.disabled;
  }
}