2012-11-29 24 views
7

Androidでコール転送の状態を取得することはできますか?このコードを使用してAndroidのコール転送状態を取得する方法コードですか?

enter image description here

のみ現在の状態とポップアップを示したが、それはどの

Intent intentCallForward = new Intent(Intent.ACTION_CALL);        
Uri uri = Uri.fromParts("tel", "*#21#", "#"); 
intentCallForward.setData(uri);         
startActivity(intentCallForward); 

答えて

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); 
     } 
    } 
} 
関連する問題