在android中如何在活动通话中发送DTMF音?

在android中如何在活动通话中发送DTMF音?,android,dtmf,Android,Dtmf,在android中,是否可以在活动通话中发送DTMF铃声?我用proxyphone.sendDtmf()试用了它,但没用 如何实现这一点?在VOIP中,只有Android应用程序才能访问通话中的音频流。您可以在免提模式下稍微伪装一下。试试这个方法()。它从用户那里获取数字和延迟 private void call(int profileid) {//call procedure logic ProfileDo profile = adapter.getProfile(profi

在android中,是否可以在活动通话中发送DTMF铃声?我用proxyphone.sendDtmf()试用了它,但没用


如何实现这一点?

在VOIP中,只有Android应用程序才能访问通话中的音频流。您可以在免提模式下稍微伪装一下。

试试这个方法()。它从用户那里获取数字和延迟

private void call(int profileid) {//call procedure logic 
        ProfileDo profile = adapter.getProfile(profileid);
        if (profile.getStepCount() == 0) {
            Toast.makeText(getApplicationContext(), "Please edit the profile and add atleast one value to make a call", 10000).show();
            return;}
            String call = "tel:";
        for (StepDO step : profile.getSteps()) {
            String value = URLEncoder.encode(step.getValue());
            int delay = step.getDelay();
            String pausesStr = "";
            for (int i = 0; i < delay / 2; i++) {
                pausesStr += PhoneNumberUtils.PAUSE;
            }
            call += value + pausesStr;
        }
         startActivity(new Intent("android.intent.action.CALL", Uri.parse(call)));      
    }
private void调用(int profileid){//调用过程逻辑
ProfileDo profile=adapter.getProfile(profileid);
if(profile.getStepCount()==0){
Toast.makeText(getApplicationContext(),“请编辑配置文件并添加至少一个值以进行调用”,10000).show();
返回;}
String call=“电话:”;
for(StepDO步骤:profile.getSteps()){
String value=URLEncoder.encode(step.getValue());
int delay=step.getDelay();
字符串pausesStr=“”;
对于(int i=0;i
在扬声器模式下如何操作?使用Tonegenerator?我用以下代码尝试了Tonegenerator mToneGenerator;mToneGenerator=新的音频发生器(AudioManager.STREAM_VOICE_CALL,100);if(mToneGenerator!=null){tone++;mToneGenerator.startTone(tone,500);if(tone==9){tone=0;}}但在其他handint durationMs=500时未获得音调;int volume_level=100;final ToneGenerator mToneGenerator=新的ToneGenerator(AudioManager.STREAM_MUSIC,volume_level);//将音量提高到100%(例如7*14~100)兆瓦发电机。stopTone();mToneGenerator.startTone(ToneGenerator.TONE\u DTMF\u 0,持续时间ms);//播放500毫秒的声音