Développement Android – Envoyer un sms depuis une application

L’envoi de SMS peut se faire depuis une application tierce.
C’est une manipulation très simple qui se fait en quelques lignes de code seulement.

 

Dans un premier temps créez la méthode envoiSMS :

[java]
private void envoiSMS(String numTelephone, String message)
{
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(numTelephone, null, message, null, null);
}
[/java]

Ensuite, utilisez cette méthode à l’endroit souhaité dans votre code (clic sur un bouton, activation de vue, etc…)

[java]
envoiSMS("061234XXXX", "Test envoi SMS");
[/java]

Petite astuce :

Si vous utilisez l’émulateur pour développer vos applications. Vous devez faire la manipulation suivante :
– Ouvrir 2 émulateurs
– Notez les numéros des émulateurs (dans la barre de tâches)
– A la place du numéro de téléphone, insérez le numéro de l’émulateur de destination (5554, 5555 ou 5556)

505 Comments Développement Android – Envoyer un sms depuis une application

  1. Lynwood

    I’d like to thank you for the efforts you’ve put in writing this site.
    I really hope to view the same high-grade blog posts from you in the future
    as well. In truth, your creative writing abilities
    has motivated me to get my own blog now 😉

    Reply
  2. akaun test ace333

    Hey would you mind letting me know which web host you’re utilizing?
    I’ve loaded your blog in 3 different browsers and I must say this blog
    loads a lot faster then most. Can you recommend a good internet
    hosting provider at a fair price? Cheers, I appreciate it!

    Also visit my web site: akaun test ace333

    Reply
  3. Xavier

    I love your blog.. very nice colors & theme. Did you design this website
    yourself or did you hire someone to do it for you? Plz answer back as I’m looking to construct my own blog and would
    like to know where u got this from. cheers

    Feel free to surf to my homepage live22 gaming (Xavier)

    Reply
  4. tango-wiki.win

    Тhis iis really interesting, You’re a very skilled Ьⅼogger.
    I’ve joined yօur rss feed and look fоrward to seeking more of your wonderfuⅼ
    post. Ꭺlso, I have shared your website in my social networks!

    Reply
  5. Pussy888Sg.com

    you’re really a good webmaster. The site loading speed is incredible.
    It sort of feels that you are doing any unique trick. Also, The contents are
    masterwork. you’ve performed a fantastic job on this topic!

    My blog post: ok388 website (Pussy888Sg.com)

    Reply
  6. Lucia

    My coder 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 numerous websites for about a
    year and am worried about switching to another platform.
    I have heard very good things about blogengine.net. Is there a
    way I can import all my wordpress posts into it? Any help would be greatly appreciated!

    Reply
  7. info lengkap

    Ӏ’m really enjoying thee design and ⅼayout of yоujr blog.

    It’s a very easy ⲟn the eyes wwhich makes it much more enjoyable forr me to come here and visit mοre often. Did you hore out
    a developer to cгeate your theme? Grеat work!

    Reply
  8. test id sky777

    I’ve been browsing on-line greater than three hours nowadays, but I never discovered any
    interesting article like yours. It is beautiful price sufficient for me.
    In my view, if all web owners and bloggers made good content
    as you probably did, the web will likely be much more helpful than ever before.

    Also visit my blog post: test id sky777

    Reply
  9. xe88sg.com

    Have you ever thought about adding a little bit more than just
    your articles? I mean, what you say is valuable and everything.
    Nevertheless think about if you added some great images
    or videos to give your posts more, “pop”! Your content
    is excellent but with images and video clips, this blog could definitely be one of the very best
    in its niche. Fantastic blog!

    Look at my webpage … home wm casino download (xe88sg.com)

    Reply
  10. 정품비아그라

    Youre so amazing! I do not mean Ive review anything such as this prior to. So wonderful to locate somebody with some initial thoughts on this subject. realy thanks for beginning this up. this website is something that is required on the internet, a person with a little originality. useful job for bringing something brand-new to the internet!

    Reply
  11. 정품비아그라

    Youre so amazing! I do not mean Ive review anything such as this prior to. So wonderful to locate somebody with some initial thoughts on this subject. realy thanks for beginning this up. this website is something that is required on the internet, a person with a little originality. useful job for bringing something brand-new to the internet!

    Reply
  12. 정품비아그라

    Youre so amazing! I do not mean Ive review anything such as this prior to. So wonderful to locate somebody with some initial thoughts on this subject. realy thanks for beginning this up. this website is something that is required on the internet, a person with a little originality. useful job for bringing something brand-new to the internet!

    Reply
  13. epl중계

    В том случае если предприниматель задумывается о надвигающихся проблемах, которые не возможно будет преодолеть то в первую очередь его интересует непосредственно субсидиарная ответственность

    Reply
  14. 정품비아그라

    Youre so amazing! I do not mean Ive review anything such as this prior to. So wonderful to locate somebody with some initial thoughts on this subject. realy thanks for beginning this up. this website is something that is required on the internet, a person with a little originality. useful job for bringing something brand-new to the internet!

    Reply
  15. 정품비아그라

    Youre so amazing! I do not mean Ive review anything such as this prior to. So wonderful to locate somebody with some initial thoughts on this subject. realy thanks for beginning this up. this website is something that is required on the internet, a person with a little originality. useful job for bringing something brand-new to the internet!

    Reply
  16. 정품비아그라

    Youre so amazing! I do not mean Ive review anything such as this prior to. So wonderful to locate somebody with some initial thoughts on this subject. realy thanks for beginning this up. this website is something that is required on the internet, a person with a little originality. useful job for bringing something brand-new to the internet!

    Reply
  17. 정품비아그라

    Youre so amazing! I do not mean Ive review anything such as this prior to. So wonderful to locate somebody with some initial thoughts on this subject. realy thanks for beginning this up. this website is something that is required on the internet, a person with a little originality. useful job for bringing something brand-new to the internet!

    Reply
  18. 정품비아그라

    Youre so amazing! I do not mean Ive review anything such as this prior to. So wonderful to locate somebody with some initial thoughts on this subject. realy thanks for beginning this up. this website is something that is required on the internet, a person with a little originality. useful job for bringing something brand-new to the internet!

    Reply
  19. 정품비아그라

    Youre so amazing! I do not mean Ive review anything such as this prior to. So wonderful to locate somebody with some initial thoughts on this subject. realy thanks for beginning this up. this website is something that is required on the internet, a person with a little originality. useful job for bringing something brand-new to the internet!

    Reply
  20. 정품비아그라

    Youre so amazing! I do not mean Ive review anything such as this prior to. So wonderful to locate somebody with some initial thoughts on this subject. realy thanks for beginning this up. this website is something that is required on the internet, a person with a little originality. useful job for bringing something brand-new to the internet!

    Reply
  21. 정품비아그라

    Youre so amazing! I do not mean Ive review anything such as this prior to. So wonderful to locate somebody with some initial thoughts on this subject. realy thanks for beginning this up. this website is something that is required on the internet, a person with a little originality. useful job for bringing something brand-new to the internet!

    Reply
  22. epl중계

    В том случае если предприниматель задумывается о надвигающихся проблемах, которые не возможно будет преодолеть то в первую очередь его интересует непосредственно субсидиарная ответственность

    Reply
  23. 정품비아그라

    Youre so amazing! I do not mean Ive review anything such as this prior to. So wonderful to locate somebody with some initial thoughts on this subject. realy thanks for beginning this up. this website is something that is required on the internet, a person with a little originality. useful job for bringing something brand-new to the internet!

    Reply
  24. 한게임머니상

    Your style is really unique in comparison to other folks I’ve read stuff from. I appreciate you for posting when you’ve got the opportunity, Guess I’ll just book mark this web site.

    Reply
  25. 시알리스 구입처

    Thanks so much for giving everyone such a splendid possiblity to read from this blog. It can be very brilliant and as well , jam-packed with a great time for me and my office fellow workers to visit your blog at least 3 times in 7 days to find out the fresh items you will have. Of course, I’m just at all times amazed for the fantastic tricks you serve. Selected 1 ideas in this post are honestly the most efficient I’ve had.

    Reply
  26. 정품비아그라

    Thanks , I’ve just been searching for information about this subject for ages and yours is the best I have discovered till now. But, what about the bottom line? Are you sure about the source?

    Reply
  27. Bassetti Kissenbezüge kaufen

    794746 715807It is a shame you dont have a donate button! Id most definitely donate to this outstanding web site! I suppose within the meantime ill be happy with bookmarking and putting your Rss feed to my Google account. I appear forward to fresh updates and will share this blog with my Facebook group: ) 630273

    Reply
  28. Minna

    It’s appropriate time to make some plans for the future and it is time to be happy.
    I’ve read this post and if I could I wish to suggest you some interesting
    things or advice. Maybe you can write next articles referring to this article.
    I wish to read more things about it!

    Reply
  29. Gerardo

    Spot on with this write-up, I truly believe this website needs far more attention. I’ll probably be back
    again to see more, thanks for the advice!

    Reply

Leave a Reply

Your email address will not be published.