我创建了短信应用程序android
我已经能够顺利发送短信,但如果我使用2 SIM卡发送,则通过SIM卡1发送会出错,并且没有发送报告,如果我想使用2 SIM卡平滑发送短信
请帮助我应该添加其源代码
我的密码
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 SDK不支持双SIM卡设备.您将需要与设备制造商联系,以确定是否以及如何使用第二个SIM卡发送SMS.
总结以上是内存溢出为你收集整理的android-如何使用SIM2或双SIM卡提交短信全部内容,希望文章能够帮你解决android-如何使用SIM2或双SIM卡提交短信所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)