2

why can't get the permission to READ_CALL_LOG in react-native expo with this code? is possible to access call log in expo?

const CallLogFunc = async () => {
  try {
    const granted = await PermissionsAndroid.request(
      PermissionsAndroid.PERMISSIONS.READ_CALL_LOG,
      {
        title: " Permission neeeded",
        message: "Allow App to access your phone call logs",
        buttonNeutral: "Ask Me Later",
        buttonNegative: "Cancel",
        buttonPositive: "OK",
      }
    );
    if (granted === PermissionsAndroid.RESULTS.GRANTED) {
      console.log("CALL LOG permission granted");
    } else {
      console.log("CALL LOG permission denied");
    }
  } catch (err) {
    console.log(err);
  }
};
Asid
  • 41
  • 5

2 Answers2

2

Check if READ_CALL_LOG permission is there in your app.json, if no then add it like below

{
  "expo": {
    ....
    ....
    "android":{
      "permissions":["READ_CALL_LOG"],
      "package":"your package name here"
    }
  }
}

Ref : Permissions

Thanhal P A
  • 4,097
  • 3
  • 18
  • 38
1

expo does not support READ_CALL_LOG permission. Please refer this issue in expo github.

Shri
  • 21
  • 3