# Sending SMS from Android

**URL:** <https://discourse.processing.org/t/sending-sms-from-android/1507>\
**Category:** Processing for Android\
**Created:** [July 5, 2018, 6:19am UTC](https://discourse.processing.org/t/sending-sms-from-android/1507 "2018-07-05T06:19:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajiv.tctech](https://avatars.discourse-cdn.com/v4/letter/r/c6cbf5/32.png) [@rajiv.tctech](https://discourse.processing.org/u/rajiv.tctech)\
**Post date:** [July 5, 2018, 6:19am UTC](https://discourse.processing.org/t/sending-sms-from-android/1507/1 "2018-07-05T06:19:45Z")

</div>

How can my Android Processing app send SMS from the Android device?

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [July 5, 2018, 7:35am UTC](https://discourse.processing.org/t/sending-sms-from-android/1507/2 "2018-07-05T07:35:17Z")

</div>

@rajiv.tctech===  
in order to do that there are several solutions: eg you can create an instance of smsManager and send your message(text message) to some phone number:

```auto
SmsManager smsManager = SmsManager.getDefault();
                  smsManager.sendTextMessage(telNumero, null, myMessage, null, null);

```

or you can do that with an intent and using the built in sms with ACTION\_VIEW:

```auto
Intent mySmsIntent = new Intent(Intent.ACTION_VIEW);
mySmsIntent.setData(Uri.parse("smsto:"));//nothing to change
mySmSIntent.setType("vnd.android-dir/mms-sms");//nothing to change
mySmsIntent.putExtra("address" , new String("0123456789;9876543210"));//phone(s) number(s): here 2
mySmsIntent.putExtra("sms_body" , "happy birthday to you");// the message

```

of course you need sms permissions  
and of course you have to addapt the code to fragment (this.getActivity()) if you are using P5 \>vs 3

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [July 5, 2018, 2:07pm UTC](https://discourse.processing.org/t/sending-sms-from-android/1507/3 "2018-07-05T14:07:11Z")

</div>

Possible relevant:

> [Demo code to receive SMS in Android/Processing - Processing Forum](https://forum.processing.org/one/topic/demo-code-to-receive-sms-in-android-processing.html)  
> [Is access to SMS available? - Processing Forum](https://forum.processing.org/one/topic/is-access-to-sms-available.html)  
> [Receiving SMS in Processing - Processing 2.x and 3.x Forum](https://forum.processing.org/two/discussion/3148/receiving-sms-in-processing)

Kf

---

<div class="post-metadata">

**Author:** ![rajiv.tctech](https://avatars.discourse-cdn.com/v4/letter/r/c6cbf5/32.png) [@rajiv.tctech](https://discourse.processing.org/u/rajiv.tctech)\
**Post date:** [July 12, 2018, 4:42pm UTC](https://discourse.processing.org/t/sending-sms-from-android/1507/4 "2018-07-12T16:42:34Z")

</div>

Thank you, @akenaton! That was neat…

---

<div class="post-metadata">

**Author:** ![masoud](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@masoud](https://discourse.processing.org/u/masoud)\
**Post date:** [September 1, 2018, 11:11am UTC](https://discourse.processing.org/t/sending-sms-from-android/1507/5 "2018-09-01T11:11:24Z")

</div>

i’m new too processing and android.  
how can I enable send or recive sms permission?

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [September 1, 2018, 1:10pm UTC](https://discourse.processing.org/t/sending-sms-from-android/1507/6 "2018-09-01T13:10:56Z")

</div>

@masoud ===  
use the android SMS class:

import android.telephony.SmsManager;

String numero= “your phone number”;  
String phoneNumberReceiver=numero;// phone number to which SMS to be send  
String message=“your message…”;// message to send  
SmsManager sms = SmsManager.getDefault();  
sms.sendTextMessage(phoneNumberReceiver, null, message, null, null);

add sms permissions, either in the manifest or runtime, depending of the target SDK; as for runtime i have already put code for that, using intent && startActivityForResult.
