skip to Main Content

my question is about Android Studio, in case someone knows how to open the message application that the android device brings to send a message when clicking on a button… I have an application developed in Android Studio with Java, which It registers contacts and I want that when a button is pressed that is to send messages, the application takes the phone number of the person to whom the button belongs and opens the phone messages application no need to send the message as a parameter.

I already did the function of making the call, but I couldn’t find examples that help me for what I want to do… I hope someone has some idea and helps me, thank you very much in advance.

2

Answers


  1. String number = "12346556";  // The number 
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.fromParts("sms", number, null)));
    
    Login or Signup to reply.
  2. you can try SMS manager api:

    SmsManager smsManager = SmsManager.getDefault();
    smsManager.sendTestMessage("phone number", null, "message content", null, null);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search