Is it possible to play music during calls so that the partner can hear it? Android

I'm trying to make an application like Call Cheater (Originally developed for Symbian OS)

Is it possible to play music during a telephone conversation where the receiver and the caller should hear the same sound or music?

If so, how to implement it?

+7
source share
7 answers

You were unable to find an application that does this because it is not possible .

The documentation clearly states ( here ):

Note You can play audio data only on the standard output device. This is currently a mobile device speaker or a Bluetooth headset. You cannot play sound files during a call during a call.

The reason for this decision is probably related to security: there are several scenarios in which this feature can be used for cons.

(OP is very similar to this , so I basically give the same answer)

+10
source

Two answers, both valid, depending on how much you don't like:

1) No, it is currently not possible to embed sound in a telephone conversation.

2) Yes, it is possible. It is also an ugly, ugly shred. Turn on the speakerphone feature of your phone. Create a media player, set the media source, set the volume to 1.0f (higher) and call player.start() . If the microphone and speakers on the phone are of reasonable quality, the other party in the call will hear music. He will also continue to hear everything you say, as well as surrounding and other sounds in the immediate vicinity.

+2
source

I think this is possible in one case.

1. Some of the built-in music players in the Android device where they do this restrict music when the call is in TelephonyManager.EXTRA_STATE_OFFHOOK (OFFHOOK STATE), so there is no way to play background music using your own players and some other players like "poweramp music palyer "

2. Using the MediaPlayer class is also not possible (clearly indicated in the documentation)

3. This is only possible in one case, if your developing custom music player (without using the MediaPlayer class) that implements

AudioManager.OnAudioFocusChangeListener, using this, you can get the status of the audio master in the code "focusChange = AUDIOFOCUS_LOSS_TRANSIENT" below (this state causes when music is playing in the background when an incoming call arrives) this state is completely in the hands of developers to play or pause music. As in accordance with your requirements, since for the question you asked if you want to play music when the call is in the OFFHOOK STATE state, do not stop the music playing in the OFFHOOK state. And this is only possible when the headset is turned off.

 AudioManager am = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE); OnAudioFocusChangeListener afChangeListener = new OnAudioFocusChangeListener() { public void onAudioFocusChange(int focusChange) { if (focusChange == AUDIOFOCUS_LOSS_TRANSIENT // Pause playback (during incoming call) } else if (focusChange == AudioManager.AUDIOFOCUS_GAIN) { // Resume playback (incoming call ends) } else if (focusChange == AudioManager.AUDIOFOCUS_LOSS) { am.unregisterMediaButtonEventReceiver(RemoteControlReceiver); am.abandonAudioFocus(afChangeListener); // Stop playback (when any other app playing music in that situation current app stop the audio) } } }; 
+2
source
 Note: You can play back the audio data only to the standard output device. Currently, that is the mobile device speaker or a Bluetooth headset. You cannot play sound files in the conversation audio during a call. See official link 

http://developer.android.com/guide/topics/media/mediaplayer.html

0
source

No, It is Immpossible. But if you want to dig it up more, you can visit Using your Android phone as a GSM gateway for VoIP , where the author concluded that

It is not possible to use Android as a GSM gateway in its current form. Even after the user ROM flashes, as they also depend on the proprietary RIL (Radio Interface Layer) firmware. Obstacles 1 and 2 (API restriction) can be removed because the source code is available to the open source community to make it possible. However, obstacle 3 (proprietary RIL) depends on the equipment suppliers. Hardware vendors usually do not make their device driver code available.

0
source

I think it's impossible. Although I found a google play app called PHONE MUSIC that states: “So when someone puts you on hold, just press a soaring musical note and start playing music or playing music when someone is on the phone with you. "

0
source

Yes, it is possible in Sony ericssion xylophone w20. I have this phone in 2010. but so far I have not seen this type of phone.

0
source

All Articles