Thursday, January 24, 2013

How to Forward an Incoming Call In Android

In Android an Incoming Call can be forwarded to any Mobile Number

Here  phoneNumberToForward  is the Nobile Number to whom Incoming Call To be Forwarded


Set Call Forwarding



String url = "tel:"+"**21*"+ phoneNumberToForward+Uri.encode("#");
              Intent intent1 = (new Intent(Intent.ACTION_CALL, Uri.parse(url)));
              intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
              startActivity(intent1);


Reset Call Forwarding


To Cancel/Reset the Call forwarding

String url = "tel:"+"##21#"+ phoneNumberToForward+Uri.encode("#");
               Intent intent1 = (new Intent(Intent.ACTION_CALL, Uri.parse(url)));
               intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
               startActivity(intent1);

11 comments:

  1. Can u give an Example

    ReplyDelete
    Replies
    1. Example
      Suppose My Mobile number is 9712589658 and I want all the calls on this number to be forward on any other number like 8802369852, Following code will do it.

      String url = "tel:"+"**21*"+ "8802369852"+Uri.encode("#");
      Intent intent1 = (new Intent(Intent.ACTION_CALL, Uri.parse(url)));
      intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      startActivity(intent1);

      Delete
    2. Hello,
      Is der a way to forward sip calls in the same manner?

      Delete
    3. To Kamlesh Yadav,

      Hi
      I tried this, but not working for me. Can you plese give me one example code.

      Thanks,
      Ravi

      Delete
    4. hiii ravi u might have forgotten to give permnisson in manifiest

      Delete
  2. Hi,
    I want to set call forwarding when receiving incoming call. I started the call forwarding activity while phone is ringing. but its not working. saying App has stopped . pls help me to get this?

    ReplyDelete
  3. Hi
    I want to forward the call when ringing.i am starting the call forward activity when the phone is ringing. but it is not working . how to achieve that?

    ReplyDelete
  4. how can i store call with caller name not number ??

    ReplyDelete
  5. i want to forward a all on user specified number. and that number store in string variable then how can use this code?

    ReplyDelete
  6. i want to forward a call on user specified number then how can i do that?

    ReplyDelete