本文介绍了如何在我的android调用应用程序中调用时打开拨号盘并按分机号码。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我正在为我的组织开发一个应用程序,它将在主要组织编号后拨打他/她的分机后连接到任何员工桌面电话。此扩展名保存在应用程序db中。假设主要联系号码为123456789,则需要分机234#才能连接员工。



在主要活动中我们有这样的代码:



意图newIntent = new Intent();

newIntent.setAction(Intent.ACTION_CALL);

newIntent.setData(Uri.parse(tel:123456789));



按照上面的代码行,应用程序可以将调用活动启动到指定的数字。但在此之后我想知道如何实现在后台以编程方式输入分机号码。



我尝试了什么:



尝试创建新的Intent来解析broadCastReceiver类中的扩展号,如下所示:

if(stateStr.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)){

state = TelephonyManager.CALL_STATE_OFFHOOK;

callReceived = true;

意图newIntent = new Intent();

newIntent.setAction (Intent.ACTION_DIAL);

newIntent.setData(Uri.parse(tel:234#));



}



但是此代码段不起作用。



然后我尝试使用MainActivity中的PAUSE / WAIT编号如下:



意图newIntent = new Intent ();

newIntent.setAction(Intent.ACTION_CALL);

newIntent.setData(Uri.parse(tel:123456789; 234#));

}

但是要求用户点击确定并发送消息发送曲调。

I am developing an apps for my organization which will connect to any employee desk phone after dialing his/her extension after main organization number. and this extension is saved in application db. suppose main contact number is "123456789" and then ext "234#" is required to connect an employee.

In Main Activity we have code like this:

Intent newIntent=new Intent();
newIntent.setAction(Intent.ACTION_CALL);
newIntent.setData(Uri.parse("tel: 123456789"));

As per above lines of code application is able to start call activity to specified number. but after this I want to know how to implement to enter extension number programmatically in background.

What I have tried:

Tried to create new Intent to parse extension number in broadCastReceiver class as below:
if(stateStr.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)){
state = TelephonyManager.CALL_STATE_OFFHOOK;
callReceived=true;
Intent newIntent=new Intent();
newIntent.setAction(Intent.ACTION_DIAL);
newIntent.setData(Uri.parse("tel: 234#"));

}

But this code snippet is not working.

Then I tried with PAUSE/WAIT number in MainActivity as below:

Intent newIntent=new Intent();
newIntent.setAction(Intent.ACTION_CALL);
newIntent.setData(Uri.parse("tel: 123456789;234#"));
}
But this ask user to click 'ok' with a message to send tune.

推荐答案


这篇关于如何在我的android调用应用程序中调用时打开拨号盘并按分机号码。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 22:28