10

I do not know how to forward the calls to voice mail programmatically in android ?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
AndroidRaji
  • 907
  • 14
  • 26

2 Answers2

2

The selected answer is only correct if you want to limit your implementation to the Android public SDK.

It is possible to send a call to voice mail programmatically on Android.

While the phone is ringing, end the call. The call will be diverted to voice mail by the network. In GSM/WCDMA this is a feature called User Determined User Busy or UDUB, it also works on CDMA devices.

There are plenty of answers on SO on how to end a call on Android:

Using Java reflection and the iTelephony interface:

End call in android programmatically or end incoming call programmatically

== Update 2020 ==

Since Android P it is possible to hangup calls using the Android SDK - therefore forwarding to voicemail is now a supported feature of Android.

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
    TelecomManager tcm = context.getSystemService(TelecomManager.class);
    if(tcm != null)
        tcm.endCall();
}

Add the necessary permission to AndroidManifest.xml

    <uses-permission android:name="android.permission. ANSWER_PHONE_CALLS" />
BitByteDog
  • 3,074
  • 2
  • 26
  • 39
1

You can't.

Call forwarding is done by your carrier not by your phone, when the call reaches your phone its too late to forward it.

Androidz
  • 401
  • 1
  • 6
  • 19