Android 我们可以按程序设置呼叫转移吗?
有没有办法在iOS/Android应用程序中设置呼叫转移的数量?如何实现?在iOS中,这对于第三方应用程序是不可能的,我很确定这永远都不可能Android 我们可以按程序设置呼叫转移吗?,android,ios,Android,Ios,有没有办法在iOS/Android应用程序中设置呼叫转移的数量?如何实现?在iOS中,这对于第三方应用程序是不可能的,我很确定这永远都不可能 private void callforward(String callForwardString) { PhoneCallListener phoneListener = new PhoneCallListener(); TelephonyManager telephonyManager = (Telephony
private void callforward(String callForwardString)
{
PhoneCallListener phoneListener = new PhoneCallListener();
TelephonyManager telephonyManager = (TelephonyManager)
this.getSystemService(Context.TELEPHONY_SERVICE);
telephonyManager.listen(phoneListener, PhoneStateListener.LISTEN_CALL_STATE);
Intent intentCallForward = new Intent(Intent.ACTION_CALL);
Uri mmiCode = Uri.fromParts("tel", callForwardString, "#");
intentCallForward.setData(mmiCode);
startActivity(intentCallForward);
}
private class PhoneCallListener extends PhoneStateListener
{
private boolean isPhoneCalling = false;
@Override
public void onCallStateChanged(int state, String incomingNumber)
{
if (TelephonyManager.CALL_STATE_RINGING == state)
{
// phone ringing
}
if (TelephonyManager.CALL_STATE_OFFHOOK == state)
{
// active
isPhoneCalling = true;
}
if (TelephonyManager.CALL_STATE_IDLE == state)
{
// run when class initial and phone call ended, need detect flag
// from CALL_STATE_OFFHOOK
if (isPhoneCalling)
{
// restart app
Intent i = getBaseContext().getPackageManager()
.getLaunchIntentForPackage(getBaseContext().getPackageName());
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
isPhoneCalling = false;
}
}
}
}
}``