SMS Manager for Dual Sim Phones?

前端 未结 3 1573
南笙
南笙 2020-12-25 13:39

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.         


        
3条回答
  •  眼角桃花
    2020-12-25 14:06

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

提交回复
热议问题