【问题标题】:how to make call with a # in number in android如何在android中使用#in号码拨打电话
【发布时间】:2013-07-17 07:05:23
【问题描述】:

我尝试了以下方法,但没有得到想要的输出。请帮忙。

    public class LCD_Test extends Activity {

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    //      setContentView(R.layout.activity_lcd__test);
            Intent callIntent = new Intent(Intent.ACTION_DIAL);
    //      String imei_encode=Uri.encode("*#06#"); // encode this as *%2306%23*
            String imei="*#06#";
            callIntent.setData(Uri.parse("tel:"+(imei)));
    //      callIntent.setData(Uri.parse("tel:"+(imei_encode))); 
//Error Invalid USSD code
            startActivity(callIntent);

    //      Intent shortcutIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:"+Uri.encode("*#0*#")));
    //      startActivity(shortcutIntent);
        }


    }

【问题讨论】:

标签: android call


【解决方案1】:

试试startActivity(new Intent("android.intent.action.CALL",Uri.parse("tel:*123" + Uri.encode("#")));

【讨论】:

  • 我想运行 *#06#... 但无法从您的代码中执行它。
【解决方案2】:

您可以使用此代码获得应用程序的解决方案

Intent out = new Intent();
out.setAction(Intent.ACTION_DIAL);
out.setData(Uri.parse("tel:" + Uri.encode("+12345#123")));
startActivity(out);

【讨论】:

    【解决方案3】:
    Intent calli=new Intent(Intent.ACTION_CALL);
    
     if ( phno.contains( "#" ))
    
        phno = Uri.encode(phno+"#");
    
     calli.setData(Uri.parse("tel:"+( phno ) ) );
    
     startActivity(calli);
    
    //where phno is string that contains phone number eg *123# or 123456789
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多