Click here to Skip to main content
14,391,964 members
Rate this:
Please Sign up or sign in to vote.
See more:
hi all
how can i send sms from android application wihout open messages and without show the sms in outbox . i try it in android 9 and it is passed , i mean i can send sms in code and the message not saved in outbox .
please any idea ,?

What I have tried:

void sendSmsMsgFnc(String mblNumVar, String smsMsgVar)
   {
       Locale local = MainActivity.locale;
       String mylanguage = local.toString();
       if (ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.SEND_SMS) == PackageManager.PERMISSION_GRANTED)
       {
           try
           {
               SmsManager smsMgrVar = SmsManager.getDefault();
               smsMgrVar.sendTextMessage(mblNumVar, null, smsMsgVar, null, null);
           }
           catch (Exception ErrVar)
           {
               Toast.makeText(getActivity().getApplicationContext(),ErrVar.getMessage().toString(),
                       Toast.LENGTH_LONG).show();
               ErrVar.printStackTrace();
           }
       }
       else
       {
           if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
           {
               requestPermissions(new String[]{Manifest.permission.SEND_SMS}, 10);
           }
       }

   }
Posted
Comments
Richard Deeming 3-Dec-19 8:21am
   
Why? That sounds like malicious behaviour to me.
David Crow 3-Dec-19 9:02am
   
"how can i send sms from android application wihout open messages and without show the sms in outbox."

I would not want an app on my phone that did this.
sameralkhalili 4-Dec-19 3:21am
   
you will get notification to allow application send sms from your mobile , there are no problem in that
sameralkhalili 4-Dec-19 3:22am
   
there are multi applications access your gallary and phone book and other things more personal from sms

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100