Saturday, June 30, 2012

Send sms from Android application

This tutorial demonstrate how we can implement a simple Android application which can send SMS. To check this application I used two emulators. If you are planning to  use emulator to check this you need to create two emulators first. I have tested this using Android 2.2 two emulators.

1. First create two emulators
    One should be emulator-5554 and the other one should be emulator-5556

2. Here is the Activity code for send SMS using intent.

import android.content.Intent;
import android.os.Bundle;
public class TestSMSActivity extends Activity {
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
        String number = "5556";
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.fromParts("sms", number, null)));

The variable "number" in line 11 is the the recipient of the SMS activity. I'm going test this application using two emulators therefore I used one emulator number for that variable. If you are going to send SMS to mobile phone replace number with mobile phone number, but remember that sending SMS from emulator to a cell phone is difficult.

Don't forget to add send SMS permission to your Manifest file.

3. Run the project.
Android device chooser window will appear. Choose an AVD. If you assigned 5556 to number variable then choose emulator-5554 to run program, other vice select emulator-5554.

Then compose message window will open. Type a simple text (Eg:-"Hello world!") there and click on send.


You can see received SMS on the other emulator



  1. When someone writes an article he/she keeps the image of a user in his/her
    mind that how a user can know it. So that's why this post is great. Thanks!
    Also visit my blog post - get latest android games

  2. Heya! I just wanted to ask if you ever have any trouble with hackers?
    My last blog (wordpress) was hacked and I ended up losing months of hard work due to no back up.
    Do you have any methods to prevent hackers?
    My webpage ; virtual number

    1. Hi,
      This is a Google blog. They provide better security. So no virus attacks.
      Try with you will definitely success.

  3. hey Chatura send me the code for stoeing database in android. Thanks in advance

  4. I’m ecstatic I discovered your website and blogs.
    root android phone

  5. My programmer is trying to persuade me to move to .net from PHP.
    I have always disliked the idea because of the costs. But he's tryiong none the less. I've been using WordPress on a variety
    of websites for about a year and am worried about
    switching to another platform. I have heard excellent things about Is there a way I can transfer all my wordpress posts into it?
    Any kind of help would be really appreciated!
    Here is my web blog : mame rom mame rom

  6. Somebody necessarily help to make critically posts I'd state. That is the very first time I frequented your web page and thus far? I amazed with the research you made to create this actual publish amazing. Fantastic task!
    Also visit my web page ... sonnerie ultrason gratuite

  7. I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. Your write up is a fine example of it.
    Android application

  8. I'm not sure why but this blog is loading extremely slow for me. Is anyone else having this problem or is it a issue on my end? I'll check back later and see if the problem
    still exists.
    My web site ::

  9. I don't even know how I ended up here, but I thought this post was good. I don't know
    who you are but definitely you are going to a famous blogger if you aren't already ;) Cheers!
    Feel free to visit my web site ... chat

  10. Very rapidly this website will be famous amid
    all blog users, due to it's good posts
    Stop by my page :: real love spells free

  11. I loved as much as you'll receive carried out right here. The sketch is attractive, your authored subject matter stylish. nonetheless, you command get bought an edginess over that you wish be delivering the following. unwell unquestionably come further formerly again as exactly the same nearly very often inside case you shield this hike.
    Feel free to surf my webpage : on front page

  12. Definitely believe that which you stated. Your favorite reason seemed to be on the internet the easiest thing
    to be aware of. I say to you, I definitely get annoyed while people
    consider worries that they plainly don't know about. You managed to hit the nail upon the top and also defined out the whole thing without having side effect , people can take a signal. Will likely be back to get more. Thanks
    my web page > he said

  13. Link exchange is nothing else but it is just placing the
    other person's blog link on your page at proper place and other person will also do similar for you.
    My webpage > the original source

  14. Its not my first time to pay a visit this web page, i am browsing
    this website dailly and take fastidious data from here all the time.
    Feel free to surf my website - history of alcohol flush reaction

  15. Wow, awesome blog layout! How long have you been blogging for?
    you make blogging look easy. The overall look of your site is excellent, let alone
    the content!
    My web site ... severance pay tax

  16. Wow, this piece of writing is good, my younger sister is analyzing these things, therefore I
    am going to inform her.
    My blog post legal online gambling

  17. Every weekend i used to pay a visit this web page, as i want enjoyment, since
    this this site conations in fact nice funny material too.
    Feel free to visit my page ; my response

  18. I have read so many content on the topic of the blogger lovers however this paragraph is in fact
    a nice paragraph, keep it up.
    My weblog homepage

  19. Please let me know if you're looking for a article author for your blog. You have some really great posts and I feel I would be a good asset. If you ever want to take some of the load off, I'd really like to write
    some articles for your blog in exchange for a link back to mine.
    Please shoot me an email if interested. Thanks!
    Here is my website :: the full details

  20. Aw, this was an extremely nice post. Finding the time and actual effort to make
    a great article… but what can I say… I procrastinate a whole lot and never manage to get
    anything done.
    My homepage - a total noob

  21. I'm excited to discover this web site. I need to to thank you for ones time just for this fantastic read!! I definitely savored every little bit of it and I have you saved to fav to see new information in your website.
    Also visit my website ... for more

  22. Hey there, You have done an excellent job. I will certainly digg it and personally suggest to my
    friends. I am confident they will be benefited from this site.
    My blog ; here i found it

  23. Hello,

    Great Example, but needed to know an additional thing.
    How can we know if the sms has been sent or not, so that we can display a toast saying that the message has been sent..

    thanks for the blog again..

  24. Hello,

    Great Example, but needed to know an additional thing.
    How can we know if the sms has been sent or not, so that we can display a toast saying that the message has been sent..

    thanks for the blog again..

  25. Hello,

    Great Example, but needed to know an additional thing.
    How can we know if the sms has been sent or not, so that we can display a toast saying that the message has been sent..

    thanks for the blog again..

  26. Hi,

    firstly thanks for a nice blog..
    but needed to know another thing... how do we know that the message has been really sent so that we can display a toast saying that the message has been sent?


  27. Εverything is very oρen with a νеrу cleаr descriptiοn of the challenges.
    It waѕ definitеly infοrmative. Your websіte iѕ extremely helpful.
    Thank yοu for shаring!
    My weblog ; send chocolates in India

  28. Hi i wanto send sms from my app. so for that im calling sms from my app using intent. how to go back to previous activity after sending sms.

  29. Thanks for the clean example Man.. Even this might help you out... Have a look...