How to use the expo-permissions.PermissionStatus function in expo-permissions

To help you get started, we’ve selected a few expo-permissions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github molenzwiebel / Mimic / frontend / components / NotificationPrompt.tsx View on Github external
export async function shouldShowNotificationPrompt(): Promise {
    const settings = await withComputerConfig();
    const canPush = await Permissions.getAsync(Permissions.NOTIFICATIONS);

    return (
        !settings.hasPromptedForNotifications &&
        (canPush.status !== Permissions.PermissionStatus.DENIED || canPush.canAskAgain)
    );
}
github expo / expo / home / utils / ImageSelectionUtils.ts View on Github external
async function ensurePermissionsAsync(): Promise {
  const { status } = await Permissions.askAsync(Permissions.CAMERA, Permissions.CAMERA_ROLL);
  if (status !== Permissions.PermissionStatus.GRANTED) {
    alert(
      'Cannot select a banner photo without media access! Please enable the "Camera" & "Camera Roll" permission in your system settings.'
    );
    return false;
  }
  return true;
}