androidsmsmanagerdual-sim

Send SMS from one SIM in dual sim moble phones


When I tried to send SMS from a dual SIM android device from an application using SMS Manager it is sending SMS from both the SIM. Can you help me with the solution.

private void sendSMS(String phoneNumber)
    {       
        String msg="app Test";
        try {
             SmsManager smsManager = SmsManager.getDefault();
             smsManager.sendTextMessage(phoneNumber, null, msg, null, null);
            // this.stopSelf();
             Toast.makeText(CallBlockingService.this, "SMS sent.",
             Toast.LENGTH_LONG).show();

          } catch (Exception e) 
        {
             Toast.makeText(CallBlockingService.this,
             "SMS faild, please try again.",
             Toast.LENGTH_LONG).show();
             e.printStackTrace();
          }       
    }

Solution

  • Provide service center number of SIM you want to send SMS from. For one of my SIM service center number is +919892051914 and for another is +919022000500

    Hence if I wanna send SMS from my one SIM then code will be

        SmsManager smsManager = SmsManager.getDefault();
        smsManager.sendTextMessage(phoneNumber, "+919892051914", msg, null, null);
    

    That's it... Enjoy....