tags:

views:

782

answers:

4

HI

Plz guide, In android how can i pass my string (less then 160 char) to default builtin sms applicaion or queue, who must do rest of process.

I meant, from my activity i want to call buitin sms application, & pass my sms string to that , then builtin application will be responsible to rest of activity like sms sent retry, ?>??

+2  A: 

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.

kosokund
I do not see where that is documented in the SDK. Got a link? If it is not documented, it will not be reliable -- device manufacturers might replace the SMS application and not respond to this Intent, for example.
CommonsWare
I found that in google groups (http://groups.google.com/group/android-developers/browse_thread/thread/2bc997d602d4bb4a).It's working well on my samsung galaxy.
kosokund
+1  A: 

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.

CommonsWare
Does ACTION_SEND launch the sms application and wait for user to click "send" or direct send the SMS ? (SMS or mail or tweet...)
kosokund
If you do not specify a destination, it will definitely wait, because it needs a number. The question does not state that the code has an SMS phone number.
CommonsWare
?????????? I dont want to launch that default or buildin application, I want to pass message body, phonenumer else to that application who must sent my sms directly without need user to click send (should not open any other interface)can i put my sms in system sms queue for sending?
harisali
OK. Use SmsManager, as I wrote above.
CommonsWare
A: 

Android SMS Application Issue..!!!!(Port Number) Hello

     Messaging APP:
     Is it possible to use port numbers(to Send SMS) in Android App like we use in  J2ME. So that only those App which have the same Port Number

can listen.

Problem Faced: There is an Application X in Both Users A & B. When we tried sending SMS from A to B using our X Messaging Application, The message will go to our App Inbox as well as Native Messaging.

Ex: There is an Application X in Both Users A & B. A sends sms to B. Only X's INBOX will get notified about the SMS and not the Native INBOX and should not store messages to Native Inbox. only application X will know about the sms.

It would be helpful if we get some solutions so that we can avoid the messages going to Native Inbox.

Thanks in Advance Nitz Malikarjuna

Nitz
You really should read the F.A.Q.
ereOn
A: 

Ok, did a little research and found this question.

So, with the piece of code that was posted above:

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

Now i want to get the smsBody from the TextView of my ListView that was generated by bindView. How should i do that?

Thanks in advance!

Philipz