是否可以在Android上检索呼叫转移状态?
使用此代码仅显示具有当前状态的弹出窗口,但我想知道是否可以获得设置的实际数字(如果有)
Intent intentCallForward = new Intent(Intent.ACTION_CALL);
Uri uri = Uri.fromParts("tel", "*#21#", "#");
intentCallForward.setData(uri);
startActivity(intentCallForward);
答案 0 :(得分:1)
很简单。您只需BroadCast
跟踪手机状态即可。尝试这样的事情:
public class CallBroadcastReceiver extends BroadcastReceiver
{
public static String numberToCall;
public void onReceive(Context context, Intent intent) {
Log.d("CallForwardingBroadCast", "CallBroadcastReceiver::onReceive got Intent: " + intent.toString());
if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL)) {
numberToCall = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
Log.d("CallRecorder", "CallBroadcastReceiver intent has EXTRA_PHONE_NUMBER: " + numberToCall);
}
}
}