I need to detect when calls come to the phone and get the name (what is shown when the call comes in, even if it is just a number or SPAM), number and photo.
I tried to do so, in the end I had the call detected only after acceptance and never had photo uri. I also tried this, but it doesn't work at all.
I want to find a not deprecated way to do this and also it should work on new android versions even if the phone is in silent mode (this is important, I've tried this solution, but it doesn't work without a sound)
I will be grateful for any help
This works for me:
And in MainActivity.kt: