android 以编程方式进行呼叫转移
我想将收到的所有呼叫转接至另一个预定义的电话号码。我搜索了论坛并发现了一些相互矛盾的答案。所以我很困惑。
首先我看了这篇文章https://stackoverflow.com/a/5735711,它表明通过android是不可能的。 但另一篇文章有一些解决方案。 https://stackoverflow.com/a/8132536/1089856
我尝试了第二篇文章中的代码,但我得到以下内容错误消息:“呼叫转移连接问题或无效的 MMI 代码。”
String callForwardString = "**21*5556#";
Intent intentCallForward = new Intent(Intent.ACTION_CALL);
Uri uri2 = Uri.fromParts("tel", callForwardString, "#");
intentCallForward.setData(uri2);
startActivity(intentCallForward);
其中 5556 是我想要转发呼叫的模拟器的编号(用于测试)。
I want to forward any calls received to another predefined phone number. I have searched forums and found some contradictory answers. so i m confused.
First I looked at this post https://stackoverflow.com/a/5735711 which suggests that it is not possible through android.
But another post has some solution. https://stackoverflow.com/a/8132536/1089856
I tried this code from second post, but i m getting the following error message: "Call Forwarding connection problem or Invalid MMI Code."
String callForwardString = "**21*5556#";
Intent intentCallForward = new Intent(Intent.ACTION_CALL);
Uri uri2 = Uri.fromParts("tel", callForwardString, "#");
intentCallForward.setData(uri2);
startActivity(intentCallForward);
Where 5556 is the number of emulator (for testing) where i want to forward call.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为你需要在设备上比模拟器更好地尝试它。
您正在使用 DTMF 代码,因此我认为您需要网络(在实际设备上)而不是模拟器上。
在模拟器上拨打相同的代码“**21*5556#”并检查。它也不起作用!将 5556 替换为您要将呼叫转接到的电话号码,然后在电话上尝试。
这意味着,DTMF 代码只能在手机上使用,而不能在没有 SIM 支持的模拟器或平板电脑上使用。
编辑:
您可以在此处找到不同的呼叫转接代码。
i think you need to try it on the device better than the emulator.
You are using DTMF codes, so i think you need network (on the actual device) rather than on the emulator.
Dial the same code "**21*5556#" on your emulator and check. It does not work either! Replace the 5556 with the phone number you want to forward the call to and then try it on phone.
Meaning, the DTMF codes would work only on mobiles not on emulators or tablets without SIM support.
EDIT:
you can find different call forwarding codes here.
删除 Uri uri2 = Uri.fromParts("tel", callForwardString, "#"); 中的“#”
如果这不起作用,请尝试 *21*number#
Remove the "#" from Uri uri2 = Uri.fromParts("tel", callForwardString, "#");
if that do not work then try just *21*number#