android-如何使用SIM2或双SIM卡提交短信

Android

1个回答

写回答

15127365442

2025-01-24 02:23

+ 关注

Android
Android

我创建了Android短信应用程序我已经能够顺利发送短信sim卡的短信,但是如果我使用2SIM卡发送,则通过SIM卡1发送将是错误的,并且如果要使用2SIM卡发送短信sim卡的短信,则没有报告。顺利请帮助我添加其源代码我的密码publicclassMAInActivityextendsActivity{ButtonsendBtn;EditTexttxtphoneNo;EditTexttxtMessage;@OverrideprotectedvoidonCreate(BundlesavedInstanceState){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(newView。OnClickListener(){publicvoidonClick(Viewview){sendSMSMessage();}});}protectedvoidsendSMSMessage(){Log。

AI
AI

i("SendSMS","");StringphoneNo=txtphoneNo。getText()。toString();Stringmessage=txtMessage。getText()。toString();try{SmsManagersmsManager=SmsManager。

getDefault();smsManager。sendTextMessage(phoneNo,null,message,null,null);Toast。makeText(getApplicationContext(),"SMSsent。

",Toast。LENGTH_LONG)。show();}catch(Exceptione){Toast。makeText(getApplicationContext(),"SMSfAIld,pleasetryagAIn。

",Toast。LENGTH_LONG)。show();e。printStackTrace();}}@OverridepublicbooleanonCreateOptionsMenu(Menumenu){//Inflatethemenu;thisaddsitemstotheactioNBArifitispresent。

getMenuInflater()。inflate(R。menu。mAIn,menu);returntrue;}}最佳答案AndroidSDK不支持双SIM卡设备。您需要与设备制造商联系,以确定是否以及如何使用第二张SIM卡发送短信。

举报有用(10分享收藏

Copyright © 2025 IZhiDa.com All Rights Reserved.

知答 版权所有 粤ICP备2023042255号