如何使提交短信SIM2或双SIM卡 [英] how to make submissions sms with SIM2 or dual SIM

查看:200
本文介绍了如何使提交短信SIM2或双SIM卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在短信应用软件Android 我已经能够顺利SMS应用,而是由SIM卡1发,如果我发送带有2 SIM应用程序就会报错并没有派出怎样,如果我想要做的短信2 SIM顺利发送报告 请帮助我应该怎么添加源$ C ​​$ C公司

我的code

 公共类MainActivity延伸活动{

   按钮sendBtn;
   的EditText txtphoneNo;
   的EditText txtMessage;

   @覆盖
   保护无效的onCreate(包savedInstanceState){
      super.onCreate(savedInstanceState);
      的setContentView(R.layout.activity_main);

      sendBtn =(按钮)findViewById(R.id.btnSendSMS);
      txtphoneNo =(EditText上)findViewById(R.id.editTextPhoneNo);
      txtMessage =(EditText上)findViewById(R.id.editTextSMS);

      sendBtn.setOnClickListener(新View.OnClickListener(){
         公共无效的onClick(视图查看){
            sendSMSMessage();
         }
      });

   }
   保护无效sendSMSMessage(){
      Log.i(发送短信,);

      字符串PHONENO = txtphoneNo.getText()的toString()。
      字符串消息= txtMessage.getText()的toString()。

      尝试 {
         SmsManager的SmsManager的= SmsManager.getDefault();
         smsManager.sendTextMessage(PHONENO,空,消息,NULL,NULL);
         Toast.makeText(getApplicationContext(),短信发送。
         Toast.LENGTH_LONG).show();
      }赶上(例外五){
         Toast.makeText(getApplicationContext(),
         短信faild,请重试。
         Toast.LENGTH_LONG).show();
         e.printStackTrace();
      }
   }

   @覆盖
   公共布尔onCreateOptionsMenu(功能菜单){
      //充气菜单;这增加了项目操作栏,如果它是present。
      。getMenuInflater()膨胀(R.menu.main,菜单);
      返回true;
   }

}
 

解决方案

Android的SDK具有双SIM卡设备的支持。您需要联系您的设备制造商,以决定是否以及如何使用第二个SIM卡发送短信。

I created sms application android I've been able to sms application smoothly but send by SIM 1 if i send with 2 SIM application it will error and there were no reports sent how if i want to do sms sending with 2 SIM smoothly please help what should I add the source code of its

my code

 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;
   }

}

解决方案

The Android SDK has no support for dual-SIM devices. You will need to contact your device manufacturer to determine if and how you can send an SMS using the second SIM.

这篇关于如何使提交短信SIM2或双SIM卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆