📅  最后修改于: 2022-03-11 15:02:20.686000             🧑  作者: Mango
import { PermissionsAndroid } from 'react-native';import CallLogs from 'react-native-call-log' componentDidMount = async() => { try { const granted = await PermissionsAndroid.request( PermissionsAndroid.PERMISSIONS.READ_CALL_LOG, { title: 'Call Log Example', message: 'Access your call logs', buttonNeutral: 'Ask Me Later', buttonNegative: 'Cancel', buttonPositive: 'OK', } ) if (granted === PermissionsAndroid.RESULTS.GRANTED) { console.log(CallLogs); CallLogs.load(5).then(c => console.log(c)); } else { console.log('Call Log permission denied'); } } catch (e) { console.log(e); } }