How to use the expo-permissions.AUDIO_RECORDING 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 EvanBacon / Instagram / App.js View on Github external
import { ActionSheetProvider } from '@expo/react-native-action-sheet';
import { Audio } from 'expo-av';
import * as React from 'react';
import { StyleSheet, View } from 'react-native';
import { connect } from 'react-redux';

import Stories from './components/Stories/StoriesExperimental';
import MainNavigation from './navigation/MainNavigation';
import NavigationService from './navigation/NavigationService';
import Gate from './rematch/Gate';
import dispatch from './rematch/dispatch';

import * as Permissions from 'expo-permissions';

const Settings = {
  permissions: [Permissions.CAMERA, Permissions.AUDIO_RECORDING],
};
// import Stories from './components/Stories/Stories';
export default class App extends React.Component {
  componentDidMount() {
    for (const permission of Settings.permissions) {
      dispatch().permissions.getAsync({ permission });
    }
  }
  render() {
    return (
      
        
          
            
               {
github expo / expo / home / utils / PermissionUtils.js View on Github external
import Constants from 'expo-constants';
import * as IntentLauncher from 'expo-intent-launcher';
import * as Permissions from 'expo-permissions';
import { Alert, Linking, Platform } from 'react-native';

const PermissionName = {
  [Permissions.CAMERA]: 'The Camera',
  [Permissions.LOCATION]: 'GPS',
  [Permissions.CAMERA_ROLL]: 'The Gallery',
  [Permissions.AUDIO_RECORDING]: 'The Microphone',
  [Permissions.NOTIFICATIONS]: 'Push Notifications',
  [Permissions.USER_FACING_NOTIFICATIONS]: 'Notifications',
  [Permissions.CONTACTS]: 'Your Contacts',
  [Permissions.CALENDAR]: 'Calendar',
  [Permissions.REMINDERS]: 'Reminders',
};

// Use a controlled prompt to ensure you retain access to the permission prompt.
// If the user rejects the controlled prompt, you can always prompt them again when they're ready.
// Otherwise you'll need to redirect the user to the system settings.
export async function controlledPromptAsync(permission, permissionReason, redirectReason) {
  const { status } = await Permissions.getAsync(permission);
  if (status === 'denied') {
    return requestAsync(permission, false, permissionReason || redirectReason);
  } else if (status === 'granted') {
    return true;
github serlo / serlo-abc / src / components / helpers / PlaySounds.tsx View on Github external
private playSoundsAndRecord = () => {
    /* tslint:disable-next-line:no-empty */
    const onPlayEnd = this.props.onPlayEnd || (() => {});
    const { sounds, delay } = this.props;

    if (this.props.record) {
      Permissions.askAsync(Permissions.AUDIO_RECORDING).then(() => {
        const recording = new Audio.Recording();

        playAll(this.props.sounds, this.props.delay)
          .then(() =>
            Audio.setAudioModeAsync({
              staysActiveInBackground: true,
              allowsRecordingIOS: true,
              interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX,
              playsInSilentModeIOS: true,
              interruptionModeAndroid:
                Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX,
              shouldDuckAndroid: true,
              playThroughEarpieceAndroid: false
            })
          )
          .then(() =>
github expo / audio-recording-example / App.js View on Github external
_askForPermissions = async () => {
    const response = await Permissions.askAsync(Permissions.AUDIO_RECORDING);
    this.setState({
      haveRecordingPermissions: response.status === 'granted',
    });
  };
github expo / expo / apps / storybook / stories / APIs / Permissions.stories.jsx View on Github external
renderSinglePermissionsButtons() {
    const permissions = [
      ['CAMERA', Permissions.CAMERA],
      ['AUDIO_RECORDING', Permissions.AUDIO_RECORDING],
      ['LOCATION', Permissions.LOCATION],
      ['USER_FACING_NOTIFICATIONS', Permissions.USER_FACING_NOTIFICATIONS],
      ['NOTIFICATIONS', Permissions.NOTIFICATIONS],
      ['CONTACTS', Permissions.CONTACTS],
      ['SYSTEM_BRIGHTNESS', Permissions.SYSTEM_BRIGHTNESS],
      ['CAMERA_ROLL', Permissions.CAMERA_ROLL],
      ['CALENDAR', Permissions.CALENDAR],
      ['REMINDERS', Permissions.REMINDERS],
    ];
    return permissions.map(([permissionName, permissionType]) => (
github EvanBacon / Instagram / screens / CameraScreen.js View on Github external
const ConnectedCameraScreen = connect(({ camera, permissions }) => ({
  camera,
  hasPermission:
    permissions[Permissions.CAMERA] === 'granted' &&
    permissions[Permissions.AUDIO_RECORDING] === 'granted',
}))(CameraScreen);
github expo / expo / apps / native-component-list / src / screens / PermissionsScreen.tsx View on Github external
renderSinglePermissionsButtons() {
    const permissions: Array<[string, Permissions.PermissionType]> = [
      ['CAMERA', Permissions.CAMERA],
      ['AUDIO_RECORDING', Permissions.AUDIO_RECORDING],
      ['LOCATION', Permissions.LOCATION],
      ['USER_FACING_NOTIFICATIONS', Permissions.USER_FACING_NOTIFICATIONS],
      ['NOTIFICATIONS', Permissions.NOTIFICATIONS],
      ['CONTACTS', Permissions.CONTACTS],
      ['SYSTEM_BRIGHTNESS', Permissions.SYSTEM_BRIGHTNESS],
      ['CAMERA_ROLL', Permissions.CAMERA_ROLL],
      ['CALENDAR', Permissions.CALENDAR],
      ['REMINDERS', Permissions.REMINDERS],
    ];
    return permissions.map(([permissionName, permissionType]) => (
github SCasarotto / casarotto-chat / src / pages / Main / Main.js View on Github external
.then((response) => {
				return Permissions.askAsync(Permissions.AUDIO_RECORDING)
			})
			.then((response) => {
github slorber / gatsby-plugin-react-native-web / examples / uikits / src / components / expo / ExpoPermissionsExample.js View on Github external
import * as Permissions from 'expo-permissions'
import React, { useEffect, useState } from 'react'
import { Button, ScrollView, Text, View } from 'react-native'

import Example from '../example'

const permissions = [
  ['CAMERA', Permissions.CAMERA],
  ['AUDIO_RECORDING', Permissions.AUDIO_RECORDING],
  ['LOCATION', Permissions.LOCATION],
  ['USER_FACING_NOTIFICATIONS', Permissions.USER_FACING_NOTIFICATIONS],
  ['NOTIFICATIONS', Permissions.NOTIFICATIONS],
  ['CONTACTS', Permissions.CONTACTS],
  ['SYSTEM_BRIGHTNESS', Permissions.SYSTEM_BRIGHTNESS],
  ['CAMERA_ROLL', Permissions.CAMERA_ROLL],
  ['CALENDAR', Permissions.CALENDAR],
  ['REMINDERS', Permissions.REMINDERS],
]

export default function PermissionsExample() {
  return (