Поскольку на вопросе есть тег Android, вот что я нашел при исследовании темы (код из codetheory.in ).
Отправка:
// 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);
Получите:
public class SmsReceiver extends BroadcastReceiver {
private String TAG = SmsReceiver.class.getSimpleName();
public SmsReceiver() {
}
@Override
public void onReceive(Context context, Intent intent) {
// Get the data (SMS data) bound to intent
Bundle bundle = intent.getExtras();
SmsMessage[] msgs = null;
String str = "";
if (bundle != null){
// Retrieve the Binary SMS data
Object[] pdus = (Object[]) bundle.get("pdus");
msgs = new SmsMessage[pdus.length];
// For every SMS message received (although multipart is not supported with binary)
for (int i=0; i<msgs.length; i++) {
byte[] data = null;
msgs[i] = SmsMessage.createFromPdu((byte[]) pdus[i]);
str += "Binary SMS from " + msgs[i].getOriginatingAddress() + " :";
str += "\nBINARY MESSAGE: ";
// Return the User Data section minus the
// User Data Header (UDH) (if there is any UDH at all)
data = msgs[i].getUserData();
// Generally you can do away with this for loop
// You'll just need the next for loop
for (int index=0; index < data.length; index++) {
str += Byte.toString(data[index]);
}
str += "\nTEXT MESSAGE (FROM BINARY): ";
for (int index=0; index < data.length; index++) {
str += Character.toString((char) data[index]);
}
str += "\n";
}
// Dump the entire message
// Toast.makeText(context, str, Toast.LENGTH_LONG).show();
Log.d(TAG, str);
}
}
}