2012-01-18 5 views
0

このコードはこのフォーラムで見つかりましたが、私は電話番号にこの文字(#または/u0023)を使用できないという問題があります。Androidは "#"と末尾に電話する

私はこの質問は既に尋ねられましたが、あなたはアプリ "Go SMS Pro"を知っているかもしれません。このアプリは実際にこの番号を呼び出すことができます。今私はそれを管理する方法を知っているかどうか尋ねたいと思います。

try { 
    Intent callIntent = new Intent(Intent.ACTION_CALL); 
    String number = "tel:*100#"; /This is the number 
    callIntent.setData(Uri.parse(asd)); 
    startActivity(callIntent); 

    TelephonyManager tManager = (TelephonyManager) 
    getSystemService(Context.TELEPHONY_SERVICE); 
    PhoneStateListener listener = new PhoneStateListener(); 
    tManager.listen(listener, PhoneStateListener.LISTEN_CALL_STATE); 
} catch (ActivityNotFoundException activityException) { 
    Log.e("telephony-example", "Call failed", activityException); 
} 
+0

エスケープ文字を試しましたか? – kosa

答えて

2

URLをエンコードします。

String number = "tel:*100%23"; 
callIntent.setData(Uri.parse(asd)); 

それとも、(のようなあなたの番号が変更された場合...)より一般的なアプローチが必要な場合 - のURLEncoderとURIのデータ部分を符号化します。

String number = "tel:"+ URLEncoder.encode("*100#"); 
.... 
関連する問題