Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SMS Manager for Dual Sim Phones?

Tags:

I am working with SMS Manager for sending sms in android.The code i am using is as below:

private void sendSms(String Phnno, String Message) {     if (Utils.checkSIM(MyActivity.this)) {         SmsManager smsManager = SmsManager.getDefault();         smsManager.sendTextMessage(Phnno, null, Message, null, null);         Utils.showMessage(MyActivity.this,"","Thank You for your interest,please check your inbox for the results.");      } else {         showErrorMessage(MyActivity.this, "SIM Error!",                 "Please insert SIM");     }  } 

This code works for me perfectly on single sim phones but when i check this in dual sim phones i am getting following warning and SMS never sends.

01-11 15:56:13.664: W/sendTextMessage(6656): use single sim interface to sendTextMessage by double sim interface 

Please suggest how i can achieve it on my dual sim phone.Thanks in Advance.

like image 974
Prabhjot Singh Avatar asked Jan 11 '13 10:01

Prabhjot Singh


People also ask

How do I set up SMS on dual SIM?

Tap on Text messages to select the default SIM when sending an SMS. Next, select one of the two SIM cards. Again, we recommend choosing the SIM card with the best plan for text messages.

Is there any SMS app that has two separate inboxes for a dual SIM?

Pulse is a free SMS and MMS messenger that works on Android devices and let you beautifully send text and media to your contacts. Sync it with many devices. Dual sim supported for work and personal use.

How can I receive SMS on my dual SIM android?

Dual SIM Dual Standby (DSDS) You can receive calls and messages to both SIM cards. Before you can use the SIM cards, you have to enable them in the Dual SIM settings menu. Data traffic can only be handled on one SIM card at a time and you can select which SIM card you want to use.


2 Answers

This Will work for both scenario. If Already user has been selected the default sim it will automatically takes that and goto the next process, Otherwise while click on the send button it will ask the confirmation for choose any sim to send the sms. we have tested its working fine.

Sample Source Code:

try  {          Intent sendIntent = new Intent(Intent.ACTION_VIEW);      sendIntent.putExtra("sms_body","Body");      sendIntent.putExtra("address", "PhoneNumber");      sendIntent.setType("vnd.android-dir/mms-sms");      startActivity(sendIntent); }  catch (Exception e)  {      Toast.makeText(getApplicationContext(),"SMS faild, please try again later!",Toast.LENGTH_SHORT).show();      e.printStackTrace(); } 
like image 124
Prasanth S Avatar answered Sep 21 '22 19:09

Prasanth S


sendTextMessage() has the scAddress parameter. This is used to define the SMS center address. I think if you set it correctly, you'll be able to send a message.

You can find the number by following this tutorial: http://algorithmic-indian.blogspot.hu/2011/03/how-to-change-message-center-number-in.html You may try this as well how to get the smsc number of a phone in android? Apparently there doesn't seem to be a way to programmatically get the number.

like image 22
allprog Avatar answered Sep 21 '22 19:09

allprog