1. Are you ready for the Galaxy S20? Here is everything we know so far!

Send SMS to most recent caller

Discussion in 'Android Development' started by ibwev, Jun 3, 2020.

  1. ibwev

    ibwev Lurker
    Thread Starter

    I have developed an app that creates predefined messages. I use the following code to open the users default texting app with the body of the text predefined:

    Code (Java):
    1.         Intent intent = new Intent(Intent.ACTION_VIEW);
    2.         intent.setData(Uri.parse("smsto:"));  // This ensures only SMS apps respond
    3.         intent.putExtra("sms_body", textStr);
    4.         if (intent.resolveActivity(getPackageManager()) != null) {
    5.             startActivity(intent);
    6.         }
    Is it possible to open the user's default texting app with the user's most recent calls received displayed? Users of my app would find it desirable to select one of the most recent phone calls with which to send a predefined text. My current workaround is to require a recent caller to text the user.

  2. Dannydet

    Dannydet Extreme Android User

    Tasker already does this
    MrJavi likes this.
  3. ibwev

    ibwev Lurker
    Thread Starter

    Thank you for replying. Sending a predefined text to most recent caller is a small component of the app I am developing; therefore, I would like to avoid using another application to satisfy this feature. Is it possible to prompt the user to send a predefined text to most recent caller using an Intent or something like it. Is there a library in Java that may allow for this type of functionality? The closest desired feature I have been able to find is the use of Intents (https://developer.android.com/guide/components/intents-common.html#Messaging). The only problem is that using an Intent to send text opens the users default texting application with the contacts most recently texted displayed. I am trying to allow the user to send a text to the contact that has most recently called.

Share This Page