Sending SMS from Android


#1

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


#2

@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:

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:

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


#3

Possible relevant:

https://forum.processing.org/one/topic/demo-code-to-receive-sms-in-android-processing.html
https://forum.processing.org/one/topic/is-access-to-sms-available.html
https://forum.processing.org/two/discussion/3148/receiving-sms-in-processing

Kf


#4

Thank you, @akenaton! That was neat…