我正试图在电话接听电话后将来电转接到其他号码。以下是我转发电话的书面代码。它正在进入此onRecieve
但呼叫不转发。请帮帮我。
@Override
public void onReceive(final Context context, Intent intent) {
TelephonyManager telephony = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
telephony.listen(new PhoneStateListener(){
@Override
public void onCallStateChanged(int state, String incomingNumber) {
super.onCallStateChanged(state, incomingNumber);
String callForwardString = "**21*9876543210#";
Intent intentCallForward = new Intent(Intent.ACTION_DIAL); // ACTION_CALL
Uri uri2 = Uri.fromParts("tel", callForwardString, "#");
intentCallForward.setData(uri2);
intentCallForward.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intentCallForward);
}
},PhoneStateListener.LISTEN_CALL_STATE);
}