Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
391 views
in Technique[技术] by (71.8m points)

android Call Forwarding programmatically

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...