There is a service in which I would like to realize the possibility of determining the current state of the phone’s sound during a phone call. Does the sound of a telephone conversation on the speaker or on the bluetooth headset. Looked in documentation that such functional gives InCallService in method getCallAudioState() . But how can I not figure out how to implement it?
|
AudioManageris only suitable for determining the sound output of music and the like. If I understand correctly inAudioManagerthere is no direct method that determines that the sound goes to the earpiece (not to the speakerphone). And in order to find out whether the sound is coming to him, you just need to checkisBluetoothScoOn(),isSpeakerphoneOn(),isWiredHeadsetOn()(or the function replacingisWiredHeadsetOn()) and if everything isfalsethen the sound goes to the speaker of the phone for a conversation, and not on the speakerphone, right? Or is there a more elegant way? - Sergey Alexandrov