react-native(리액트 네이티브) API - PermissionsAndroid
import { PermissionsAndroid } from 'react-native';
async function requestCameraPermission() {
try {
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.CAMERA,
{
'title': 'Cool Photo App Camera Permission',
'message': 'Cool Photo App needs access to your camera ' +
'so you can take awesome pictures.'
}
)
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
console.log("You can use the camera")
} else {
console.log("Camera permission denied")
}
} catch (err) {
console.warn(err)
}
}
'프로그래밍(Programming) > 리액트 네이티브(React Native)' 카테고리의 다른 글
react-native(리액트 네이티브) API - TimePickerAndroid (0) | 2019.01.08 |
---|---|
react-native(리액트 네이티브) API - Share (0) | 2019.01.08 |
react-native(리액트 네이티브) API - PanResponder (0) | 2019.01.07 |
react-native(리액트 네이티브) API - OrientationChange (0) | 2019.01.07 |
react-native(리액트 네이티브) API - Linking (0) | 2019.01.07 |