Most Apps which include audio playback – mainly audio- and videoplayers but also navigation systems with speech output and games – request READ_PHONE_STATE in their manifest to get notified about incoming calls in the
Unfortunately this permission allows a lot more than just detect incoming calls – for example the App will also see the numbers of the callers or can read the IMEI of the device. Generally there is the conception (also by developers) that this is neccessary – really?
No – in fact this is possible in a better way: Instead of using
PhoneStateListener() which requires the permission READ_PHONE_STATE, you can also use
onAudioFocusChange(). This does not require any special permissions, does not reveal any confidential data, and this callback is exactly made for the purpose that Apps can reduce the volume of their audio playback or stop the playback at all if neccessary.
Also see: Documentation OnAudioFocusChangeListener