android: handover sms to default application

Please guide, in Android how can I pass my string (less then 160 char) to the default built-in SMS applicaion or queue, which will complete the process.

I mean, from my activity I want to call a built-in SMS application and pass my SMS string to that, then the built-in application will be responsible to rest of activity like SMS resending, etc.

Asked by: Leonardo747 | Posted: 25-01-2022

Answer 1

To call the default sms application, with sms body and phone number :

Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "sms:" + phoneNumber ) );
intent.putExtra( "sms_body", smsBody );
context.startActivity( intent );

By default I mean the application chosen by the user. Actually it's better to start the default sms application than the built-in because you have to respect the user choice. If the device owner has chosen ChompSms as default SMS application, he will prefer your application launches ChompSms and not an other.

Answered by: Nicole865 | Posted: 26-02-2022

Answer 2

To call the default sms application, with sms body and phone number :

Uri uri = Uri.parse("smsto:123456789");   
    Intent it = new Intent(Intent.ACTION_SENDTO, uri);   
    it.putExtra("sms_body", "The Hello How R U...");   

Answered by: Stuart597 | Posted: 26-02-2022

Answer 3

Beyond Thomas' answer, you can use ACTION_SEND and createChooser() to allow the user to pick the application with which to send your message, whether that be the built-in SMS application or a third-party SMS application or email or GMail or Twidroid or whatever.

You can also use SmsManager to send the SMS yourself, but that will not pop up any built-in activity.

With luck, there is a spot in the documentation that covers Thomas's answer (elsewhere in this StackOverflow page), as that is the simplest solution to your request.

Answered by: Kimberly579 | Posted: 26-02-2022

Similar questions

Android: click within WebView causes callback to Android application

I'm thinking of implementing a HTML welcome panel to our Android app, which presents news and offers on the start-up screen. My question is now, if I present an offer to a specific place (with an id string) can I trigger a callback from the WebView (maybe via Java Script) to the Android app and passing that id string to make it start a new Activity which loads and shows data from a se...

android application memory leaks

I am using kind of results search engine, problem is to remember the searching criteria i made singleton static class which keeps only one instance. In my application there are lots of class level private variables, lots of public static variables, a big util class which contains only static final methods. problem is my application get crash any time any where any spot and interesting thing is crash code a...

Android Application data should not be released by android OS

public class MYApplication extends Application { String property; setter getter } does above code make sure property will not be collectied by android OS if not used for a long period of time.

Android Email application - Is it possible to get all the details which are configured in Email application

Is there any way to get in the code: Email id Password SMTP host SMTP port which the user used to setup his Email account with the Android built in Email application Required because, I am written a MailSender class using JavaMail API there I need to send the mail using the details what user configured in Built in Android Email application.

Android Intent for Twitter application

Is it possible to show a list of applications (with intent.createChooser) that only show me my twitter apps on my phone (so htc peep (htc hero) or twitdroid). I have tried it with intent.settype("application/twitter") but it doesnt find any apps for twitter and only shows my mail apps. Thank you, Wouter

webserver - Retrieve data from a web server for android application

I am developing an application that needs to retrieve some data from a web server. But I have no idea how can this be possible?

Should a legacy Android application be rebuilt using SDK 2.1?

I have an Android application that uses the well known Strategies for Legacy Applications. It is build with the Android SDK 2.0 with manifest settings minSdkVersion="3" (API 1.5) and targetSdkVersion="5" (2.0). Question1: Since maxSdkVersion is not specified, the application should be...

android - Intent to pick an installed application slow in my activity, why?

If you long press on your homescreen and pick to add an application shortcut, you will be greeted with a listview showing all of your instal applications. I needed this same functionality in my application so I copied the intent from the launcher source: Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); Intent pic...

web services - How to store data accessible to both a web site and android application?

I’m developing an Android and web application that will function as a service (use the same data). My question is how should the data be stored to allow for both the web and the android application to have access to the same set of data? Should the android application connect to the sites MySQL server to store/access data? If so how do I allow someone to access the data when they are not in ...

Android 1.6 SMS (older application code)

I have HTC Tattoo with Android 1.6. I have maed a Java program for SMS sending. I got the source on the Internet, I think, versions before 1.6. The problem is: SMSs are sent twice. What is a possible cause for this problem? If possible, please simply post sample code what works OK.

How to close Android application?

I want to close my application, so that it no longer runs in the background. How to do that? Is this good practice on Android platform? If I rely on the "back" button, it closes the app, but it stays in background. There is even application called "TaskKiller" just to kill those apps in the background.

Still can't find your answer? Check out these communities...

Android Google Support | Android Community | Android Community (Facebook) | Android