How to detect incoming calls, in an Android device?

前端 未结 10 1600
一向
一向 2020-11-22 02:27

I\'m trying to make an app like, when a call comes to the phone I want to detect the number. Below is what I tried, but it\'s not detecting incoming calls.

I want t

10条回答
  •  后悔当初
    2020-11-22 02:36

    With Android P - Api Level 28: You need to get READ_CALL_LOG permission

    Restricted access to call logs

    Android P moves the CALL_LOG, READ_CALL_LOG, WRITE_CALL_LOG, and PROCESS_OUTGOING_CALLS permissions from the PHONE permission group to the new CALL_LOG permission group. This group gives users better control and visibility to apps that need access to sensitive information about phone calls, such as reading phone call records and identifying phone numbers.

    To read numbers from the PHONE_STATE intent action, you need both the READ_CALL_LOG permission and the READ_PHONE_STATE permission. To read numbers from onCallStateChanged(), you now need the READ_CALL_LOG permission only. You no longer need the READ_PHONE_STATE permission.

提交回复
热议问题