【问题标题】:how to make submissions sms with SIM2 or dual SIM如何使用 SIM2 或双 SIM 卡提交短信
【发布时间】:2013-11-01 13:55:49
【问题描述】:

我创建了短信应用android 我已经能够顺利发送短信应用程序,但是如果我使用 2 个 SIM 卡应用程序发送它会出错,并且没有发送报告如果我想用 2 个 SIM 卡顺利发送短信,则通过 SIM 1 发送 请帮助我应该添加它的源代码

我的代码

 public class MainActivity extends Activity {

   Button sendBtn;
   EditText txtphoneNo;
   EditText txtMessage;

   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);

      sendBtn = (Button) findViewById(R.id.btnSendSMS);
      txtphoneNo = (EditText) findViewById(R.id.editTextPhoneNo);
      txtMessage = (EditText) findViewById(R.id.editTextSMS);

      sendBtn.setOnClickListener(new View.OnClickListener() {
         public void onClick(View view) {
            sendSMSMessage();
         }
      });

   }
   protected void sendSMSMessage() {
      Log.i("Send SMS", "");

      String phoneNo = txtphoneNo.getText().toString();
      String message = txtMessage.getText().toString();

      try {
         SmsManager smsManager = SmsManager.getDefault();
         smsManager.sendTextMessage(phoneNo, null, message, null, null);
         Toast.makeText(getApplicationContext(), "SMS sent.",
         Toast.LENGTH_LONG).show();
      } catch (Exception e) {
         Toast.makeText(getApplicationContext(),
         "SMS faild, please try again.",
         Toast.LENGTH_LONG).show();
         e.printStackTrace();
      }
   }

   @Override
   public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
   }

}

【问题讨论】:

    标签: android sms dual-sim


    【解决方案1】:

    Android SDK 不支持双 SIM 卡设备。您需要联系您的设备制造商,以确定是否以及如何使用第二张 SIM 卡发送 SMS。

    【讨论】:

    • Android SDK 5.1 及更高版本中提供的 Sim 选择选项
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-07-22
    • 2013-06-15
    • 1970-01-01
    • 2019-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多