As there is an Android tag to the question, here is what I found while researching a topic (code from codetheory.in ).
Send:
// Get the default instance of SmsManager SmsManager smsManager = SmsManager.getDefault(); String phoneNumber = "9999999999"; byte[] smsBody = "Let me know if you get this SMS".getBytes(); short port = 6734; // Send a text based SMS smsManager.sendDataMessage(phoneNumber, null, port, smsBody, null, null);
Reception:
public class SmsReceiver extends BroadcastReceiver { private String TAG = SmsReceiver.class.getSimpleName(); public SmsReceiver() { } @Override public void onReceive(Context context, Intent intent) {
source share