Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/186.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android中通话时的背景声音_Android - Fatal编程技术网

android中通话时的背景声音

android中通话时的背景声音,android,Android,我想在打电话给某人时自动播放声音 但我不知道该怎么做 这是可能的,因为我们有一些应用程序,发挥一些噪音交通和。。。到呼叫的背景,但我找不到此的代码或其他内容 这是播放音乐的代码 MediaPlayer player; AssetFileDescriptor afd; try { // Read the music file from the asset folder afd = getAssets().openFd(“home.mp3″); // Creation of

我想在打电话给某人时自动播放声音 但我不知道该怎么做

这是可能的,因为我们有一些应用程序,发挥一些噪音交通和。。。到呼叫的背景,但我找不到此的代码或其他内容

这是播放音乐的代码

MediaPlayer player;
AssetFileDescriptor afd;
try {
    // Read the music file from the asset folder
    afd = getAssets().openFd(“home.mp3″);
    // Creation of new media player;
    player = new MediaPlayer();
    // Set the player music source.
    player.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(),afd.getLength());
    // Set the looping and play the music.
    player.setLooping(true);
    player.prepare();
    player.start();
} catch (IOException e) {
    e.printStackTrace();
}

但是我们可以在通话中使用这个吗?

你说的背景音乐是什么意思?你想听另一个人听音乐吗?这是不受支持的。这意味着当另一个人接听电话时,我会在我的应用程序中拨一个号码并播放录制的音乐。是的,但是你想在哪里听到音乐?在进行播放的设备上,在您呼叫的人的设备上,或者两者都有?我想让我呼叫的人听到,但不重要的是,在我的设备上它听到了,或者我在第一次评论中说,这是不受支持的。Android应用程序不允许向语音通话上行注入音频。