0

I'm getting All contacts number in android phone using React-native-contacts

problem: i want fetch unique phone number as par every name

This is image where we get all phone number

async function getCallData() {
    try {
        const granted = await PermissionsAndroid.request(
            PermissionsAndroid.PERMISSIONS.READ_CALL_LOG,
            {
                title: 'Read Call Logs',
                message: 'to provide you full information access your call logs.',
                buttonPositive: 'OK',
            }
        )
        if (granted === PermissionsAndroid.RESULTS.GRANTED) {
            setPermission(true)
            CallLogs.load(400).then(logs => {
                // console.log('Calll', logs);
                setoldDataLogs(logs)
                setcallLogsData(logs)
            })
        } else {
            alert('Call Log permission denied, Please Allow to read call Logs ?');
            setPermission(false)

        }
    } catch (error) {
        console.log('Error Load Call Logs', error)
    }
}

0 Answers0