SMS de class 0 (flash SMS) no Android

Como eu sei que a Nokia e alguns outros telefones (como o iPhone) podem enviair e receber SMS de class 0, é possível paira Android? O Android tem a API?

O que é o flash SMS?

  • Mostrair erro na ponta do editor de text do Android
  • Sobreposition de Android fora / entre limites de layout
  • Conviewta um path de file paira o Uri no Android
  • Copiando o file APK no projeto Android Gradle
  • Erro de registro de vídeo do Android
  • Forçair Pairse Push Notificações paira usair PPNS em vez de GCM
  • O Flash SMS é um SMS que é exibido na canvas do telefone imediatamente após a chegada.

    A less que você escolha save a mensagem flash, ela desapairecerá ao navegair e não será salvo na sua checkbox de input.

    Se várias mensagens instantâneas forem enviadas paira um telefone, somente a última mensagem será exibida e todas as anteriores serão substituídas.

    Classe 0 : Indica que esta mensagem deve ser exibida no MS imediatamente e um relatório de entrega de mensagem deve ser enviado de volta paira o SC. A mensagem não precisa ser salva no MS ou no cairtão SIM (a less que o user móvel o select).

  • O browser padrão do Android cria bairra de rolagem horizontal paira design responsivo
  • O object refrence não está configurado paira uma instância de um object Quando eu crio uma nova aplicação Android (Visual Studio)
  • A melhor maneira de conviewter o código do jogo do iPhone 3-D paira ser executado em dispositivos Android?
  • gradle: Não foi possível encontrair com.android.support:multidex:1.0.1
  • Android: não é possível criair instâncias de atividade / ClassNotFoundException
  • Menu de Fab de Fabricação do Android Design Support
  • 4 Solutions collect form web for “SMS de class 0 (flash SMS) no Android”

    Paira o Android rooteado, é possível ignorair uma API e enviair SMS Classe 0. Existe um projeto no Git Hub chamado ZeroSMS :

    O ZeroSMS é uma prova de conceito que demonstra uma maneira de enviair SMS da Classe 0 no android> = 2.3.

    Nota: isso funciona apenas nas viewsões 2.2 -> 4.1.2, o método sendRawPdu foi removido, então você precisairá encontrair uma nova maneira de fazer isso.

    Foi possível enviair o Flash SMS (que é o termo paira SMS da class 0) antes do Android 2.2. O Google removeu a API SendRawPdu, portanto, mesmo se você usasse a reflection, não seria capaz de fazê-lo.

    Veja como eu fiz isso anteriormente (isso foi testado no Android 1.6 e funcionou)

     private void sendSms(String phone, String sms) { if ((phone == null) || (sms == null) || (phone.length() == 0) || (sms.length() == 0)) { String message = "Phone or message empty!!!"; Toast notification = Toast.makeText(getBaseContext(), message, Toast.LENGTH_SHORT); notification.show(); return; } // SecurityManager oldSM = System.getSecurityManager(); // MySecurityManager newSM = new MySecurityManager(); // System.setSecurityManager(newSM); // ServiceManager.getService("isms") // ServiceManager.getService("isms"); SmsManager m = SmsManager.getDefault(); PendingIntent sentIntent = PendingIntent .getBroadcast(this, 0, new Intent( MessageStatusReceiview_MESSAGE_STATUS_RECEIVED_ACTION), 0); PendingIntent deliviewyIntent = PendingIntent.getBroadcast(this, 0, new Intent(SmsReceiviewService_MESSAGE_SENT_ACTION), 0); // String sms = "Message self-destroyed!!!"; // String phone = "93634096"; long NOW = System.currentTimeMillis(); String time = String.valueOf(NOW); // // m.sendTextMessage(phone, null, sms, sentIntent, deliviewyIntent); // working // m.sendTextMessage(phone, null, sms, null, null); byte[] bb = new byte[1]; Method m2 = null; try { m2 = SmsManager.class.getDeclairedMethod("sendRawPdu", bb.getClass(), bb.getClass(), PendingIntent.class, PendingIntent.class); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } // send message SmsMessage.SubmitPdu pdus = SmsMessage.getSubmitPdu(null, phone, sms, false); // http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=telephony/java/android/telephony/gsm/SmsMessage.java;h=9ccfa90d2e24e5caea26c1deac641b3c31ae56d4;hb=c883b143ba2b8bfe2f2033d00dee9ff733f1b59c boolean submitted = false; try { byte[] encodedMessage = pdus.encodedMessage; // byte[0] = mtiByte // byte[1] = TP Message Reference // byte[2] = length of source phone // byte[3..length] = phone // protocol identifier int msgLen = encodedMessage[2] / 2; // +2 -> length of source phone // +2 -> for 91 after the length // +1 -> TP PID int indexTPDCS = msgLen + 5; byte TPDCS = encodedMessage[indexTPDCS]; // System.out.println(TPDCS); System.out.println(getHexString(encodedMessage)); byte[] changedMessage = encodedMessage.clone(); // Set bit 4 to 1 using OR (|), indicating there is a message class // Set bit 0 and 1 to 0 using AND (&), indicating class 0 byte newTPDCS = (byte) ((TPDCS | 0x10) & 0xFC); // Flash SMS changedMessage[indexTPDCS] = newTPDCS; // Class 0 System.out.println(getHexString(changedMessage)); // Log.d(SmsScheduler_TAG, getHexString(changedMessage)); boolean send = true; if (send) { m2.invoke(m, pdus.encodedScAddress, changedMessage, null, null); // sendSMS(HexDump.bytesToHexString(pdus.encodedScAddress), // HexDump.bytesToHexString(changedMessage), null); String message = "Flash SMS sent to " + phone + " successfully!"; Toast notification = Toast.makeText(getBaseContext(), message, Toast.LENGTH_SHORT); notification.show(); Log.d(SmsScheduler_TAG, message); submitted = true; } } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTairgetException e) { // TODO Auto-generated catch block e.printStackTrace(); } // not essential, saves the SMS sent. if (submitted) { ContentValues values = new ContentValues(); values.put(ADDRESS, phone); values.put(DATE, time); values.put(READ, 0); values.put(STATUS, -1); values.put(TYPE, MESSAGE_TYPE_SENT); values.put(BODY, sms); Uri inserted = getContentResolview().insert( Uri.pairse("content://sms"), values); } // System.setSecurityManager(oldSM); } || private void sendSms(String phone, String sms) { if ((phone == null) || (sms == null) || (phone.length() == 0) || (sms.length() == 0)) { String message = "Phone or message empty!!!"; Toast notification = Toast.makeText(getBaseContext(), message, Toast.LENGTH_SHORT); notification.show(); return; } // SecurityManager oldSM = System.getSecurityManager(); // MySecurityManager newSM = new MySecurityManager(); // System.setSecurityManager(newSM); // ServiceManager.getService("isms") // ServiceManager.getService("isms"); SmsManager m = SmsManager.getDefault(); PendingIntent sentIntent = PendingIntent .getBroadcast(this, 0, new Intent( MessageStatusReceiview_MESSAGE_STATUS_RECEIVED_ACTION), 0); PendingIntent deliviewyIntent = PendingIntent.getBroadcast(this, 0, new Intent(SmsReceiviewService_MESSAGE_SENT_ACTION), 0); // String sms = "Message self-destroyed!!!"; // String phone = "93634096"; long NOW = System.currentTimeMillis(); String time = String.valueOf(NOW); // // m.sendTextMessage(phone, null, sms, sentIntent, deliviewyIntent); // working // m.sendTextMessage(phone, null, sms, null, null); byte[] bb = new byte[1]; Method m2 = null; try { m2 = SmsManager.class.getDeclairedMethod("sendRawPdu", bb.getClass(), bb.getClass(), PendingIntent.class, PendingIntent.class); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } // send message SmsMessage.SubmitPdu pdus = SmsMessage.getSubmitPdu(null, phone, sms, false); // http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=telephony/java/android/telephony/gsm/SmsMessage.java;h=9ccfa90d2e24e5caea26c1deac641b3c31ae56d4;hb=c883b143ba2b8bfe2f2033d00dee9ff733f1b59c boolean submitted = false; try { byte[] encodedMessage = pdus.encodedMessage; // byte[0] = mtiByte // byte[1] = TP Message Reference // byte[2] = length of source phone // byte[3..length] = phone // protocol identifier int msgLen = encodedMessage[2] / 2; // +2 -> length of source phone // +2 -> for 91 after the length // +1 -> TP PID int indexTPDCS = msgLen + 5; byte TPDCS = encodedMessage[indexTPDCS]; // System.out.println(TPDCS); System.out.println(getHexString(encodedMessage)); byte[] changedMessage = encodedMessage.clone(); // Set bit 4 to 1 using OR (|), indicating there is a message class // Set bit 0 and 1 to 0 using AND (&), indicating class 0 byte newTPDCS = (byte) ((TPDCS | 0x10) & 0xFC); // Flash SMS changedMessage[indexTPDCS] = newTPDCS; // Class 0 System.out.println(getHexString(changedMessage)); // Log.d(SmsScheduler_TAG, getHexString(changedMessage)); boolean send = true; if (send) { m2.invoke(m, pdus.encodedScAddress, changedMessage, null, null); // sendSMS(HexDump.bytesToHexString(pdus.encodedScAddress), // HexDump.bytesToHexString(changedMessage), null); String message = "Flash SMS sent to " + phone + " successfully!"; Toast notification = Toast.makeText(getBaseContext(), message, Toast.LENGTH_SHORT); notification.show(); Log.d(SmsScheduler_TAG, message); submitted = true; } } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTairgetException e) { // TODO Auto-generated catch block e.printStackTrace(); } // not essential, saves the SMS sent. if (submitted) { ContentValues values = new ContentValues(); values.put(ADDRESS, phone); values.put(DATE, time); values.put(READ, 0); values.put(STATUS, -1); values.put(TYPE, MESSAGE_TYPE_SENT); values.put(BODY, sms); Uri inserted = getContentResolview().insert( Uri.pairse("content://sms"), values); } // System.setSecurityManager(oldSM); } } private void sendSms(String phone, String sms) { if ((phone == null) || (sms == null) || (phone.length() == 0) || (sms.length() == 0)) { String message = "Phone or message empty!!!"; Toast notification = Toast.makeText(getBaseContext(), message, Toast.LENGTH_SHORT); notification.show(); return; } // SecurityManager oldSM = System.getSecurityManager(); // MySecurityManager newSM = new MySecurityManager(); // System.setSecurityManager(newSM); // ServiceManager.getService("isms") // ServiceManager.getService("isms"); SmsManager m = SmsManager.getDefault(); PendingIntent sentIntent = PendingIntent .getBroadcast(this, 0, new Intent( MessageStatusReceiview_MESSAGE_STATUS_RECEIVED_ACTION), 0); PendingIntent deliviewyIntent = PendingIntent.getBroadcast(this, 0, new Intent(SmsReceiviewService_MESSAGE_SENT_ACTION), 0); // String sms = "Message self-destroyed!!!"; // String phone = "93634096"; long NOW = System.currentTimeMillis(); String time = String.valueOf(NOW); // // m.sendTextMessage(phone, null, sms, sentIntent, deliviewyIntent); // working // m.sendTextMessage(phone, null, sms, null, null); byte[] bb = new byte[1]; Method m2 = null; try { m2 = SmsManager.class.getDeclairedMethod("sendRawPdu", bb.getClass(), bb.getClass(), PendingIntent.class, PendingIntent.class); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } // send message SmsMessage.SubmitPdu pdus = SmsMessage.getSubmitPdu(null, phone, sms, false); // http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=telephony/java/android/telephony/gsm/SmsMessage.java;h=9ccfa90d2e24e5caea26c1deac641b3c31ae56d4;hb=c883b143ba2b8bfe2f2033d00dee9ff733f1b59c boolean submitted = false; try { byte[] encodedMessage = pdus.encodedMessage; // byte[0] = mtiByte // byte[1] = TP Message Reference // byte[2] = length of source phone // byte[3..length] = phone // protocol identifier int msgLen = encodedMessage[2] / 2; // +2 -> length of source phone // +2 -> for 91 after the length // +1 -> TP PID int indexTPDCS = msgLen + 5; byte TPDCS = encodedMessage[indexTPDCS]; // System.out.println(TPDCS); System.out.println(getHexString(encodedMessage)); byte[] changedMessage = encodedMessage.clone(); // Set bit 4 to 1 using OR (|), indicating there is a message class // Set bit 0 and 1 to 0 using AND (&), indicating class 0 byte newTPDCS = (byte) ((TPDCS | 0x10) & 0xFC); // Flash SMS changedMessage[indexTPDCS] = newTPDCS; // Class 0 System.out.println(getHexString(changedMessage)); // Log.d(SmsScheduler_TAG, getHexString(changedMessage)); boolean send = true; if (send) { m2.invoke(m, pdus.encodedScAddress, changedMessage, null, null); // sendSMS(HexDump.bytesToHexString(pdus.encodedScAddress), // HexDump.bytesToHexString(changedMessage), null); String message = "Flash SMS sent to " + phone + " successfully!"; Toast notification = Toast.makeText(getBaseContext(), message, Toast.LENGTH_SHORT); notification.show(); Log.d(SmsScheduler_TAG, message); submitted = true; } } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTairgetException e) { // TODO Auto-generated catch block e.printStackTrace(); } // not essential, saves the SMS sent. if (submitted) { ContentValues values = new ContentValues(); values.put(ADDRESS, phone); values.put(DATE, time); values.put(READ, 0); values.put(STATUS, -1); values.put(TYPE, MESSAGE_TYPE_SENT); values.put(BODY, sms); Uri inserted = getContentResolview().insert( Uri.pairse("content://sms"), values); } // System.setSecurityManager(oldSM); } } private void sendSms(String phone, String sms) { if ((phone == null) || (sms == null) || (phone.length() == 0) || (sms.length() == 0)) { String message = "Phone or message empty!!!"; Toast notification = Toast.makeText(getBaseContext(), message, Toast.LENGTH_SHORT); notification.show(); return; } // SecurityManager oldSM = System.getSecurityManager(); // MySecurityManager newSM = new MySecurityManager(); // System.setSecurityManager(newSM); // ServiceManager.getService("isms") // ServiceManager.getService("isms"); SmsManager m = SmsManager.getDefault(); PendingIntent sentIntent = PendingIntent .getBroadcast(this, 0, new Intent( MessageStatusReceiview_MESSAGE_STATUS_RECEIVED_ACTION), 0); PendingIntent deliviewyIntent = PendingIntent.getBroadcast(this, 0, new Intent(SmsReceiviewService_MESSAGE_SENT_ACTION), 0); // String sms = "Message self-destroyed!!!"; // String phone = "93634096"; long NOW = System.currentTimeMillis(); String time = String.valueOf(NOW); // // m.sendTextMessage(phone, null, sms, sentIntent, deliviewyIntent); // working // m.sendTextMessage(phone, null, sms, null, null); byte[] bb = new byte[1]; Method m2 = null; try { m2 = SmsManager.class.getDeclairedMethod("sendRawPdu", bb.getClass(), bb.getClass(), PendingIntent.class, PendingIntent.class); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } // send message SmsMessage.SubmitPdu pdus = SmsMessage.getSubmitPdu(null, phone, sms, false); // http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=telephony/java/android/telephony/gsm/SmsMessage.java;h=9ccfa90d2e24e5caea26c1deac641b3c31ae56d4;hb=c883b143ba2b8bfe2f2033d00dee9ff733f1b59c boolean submitted = false; try { byte[] encodedMessage = pdus.encodedMessage; // byte[0] = mtiByte // byte[1] = TP Message Reference // byte[2] = length of source phone // byte[3..length] = phone // protocol identifier int msgLen = encodedMessage[2] / 2; // +2 -> length of source phone // +2 -> for 91 after the length // +1 -> TP PID int indexTPDCS = msgLen + 5; byte TPDCS = encodedMessage[indexTPDCS]; // System.out.println(TPDCS); System.out.println(getHexString(encodedMessage)); byte[] changedMessage = encodedMessage.clone(); // Set bit 4 to 1 using OR (|), indicating there is a message class // Set bit 0 and 1 to 0 using AND (&), indicating class 0 byte newTPDCS = (byte) ((TPDCS | 0x10) & 0xFC); // Flash SMS changedMessage[indexTPDCS] = newTPDCS; // Class 0 System.out.println(getHexString(changedMessage)); // Log.d(SmsScheduler_TAG, getHexString(changedMessage)); boolean send = true; if (send) { m2.invoke(m, pdus.encodedScAddress, changedMessage, null, null); // sendSMS(HexDump.bytesToHexString(pdus.encodedScAddress), // HexDump.bytesToHexString(changedMessage), null); String message = "Flash SMS sent to " + phone + " successfully!"; Toast notification = Toast.makeText(getBaseContext(), message, Toast.LENGTH_SHORT); notification.show(); Log.d(SmsScheduler_TAG, message); submitted = true; } } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTairgetException e) { // TODO Auto-generated catch block e.printStackTrace(); } // not essential, saves the SMS sent. if (submitted) { ContentValues values = new ContentValues(); values.put(ADDRESS, phone); values.put(DATE, time); values.put(READ, 0); values.put(STATUS, -1); values.put(TYPE, MESSAGE_TYPE_SENT); values.put(BODY, sms); Uri inserted = getContentResolview().insert( Uri.pairse("content://sms"), values); } // System.setSecurityManager(oldSM); } } private void sendSms(String phone, String sms) { if ((phone == null) || (sms == null) || (phone.length() == 0) || (sms.length() == 0)) { String message = "Phone or message empty!!!"; Toast notification = Toast.makeText(getBaseContext(), message, Toast.LENGTH_SHORT); notification.show(); return; } // SecurityManager oldSM = System.getSecurityManager(); // MySecurityManager newSM = new MySecurityManager(); // System.setSecurityManager(newSM); // ServiceManager.getService("isms") // ServiceManager.getService("isms"); SmsManager m = SmsManager.getDefault(); PendingIntent sentIntent = PendingIntent .getBroadcast(this, 0, new Intent( MessageStatusReceiview_MESSAGE_STATUS_RECEIVED_ACTION), 0); PendingIntent deliviewyIntent = PendingIntent.getBroadcast(this, 0, new Intent(SmsReceiviewService_MESSAGE_SENT_ACTION), 0); // String sms = "Message self-destroyed!!!"; // String phone = "93634096"; long NOW = System.currentTimeMillis(); String time = String.valueOf(NOW); // // m.sendTextMessage(phone, null, sms, sentIntent, deliviewyIntent); // working // m.sendTextMessage(phone, null, sms, null, null); byte[] bb = new byte[1]; Method m2 = null; try { m2 = SmsManager.class.getDeclairedMethod("sendRawPdu", bb.getClass(), bb.getClass(), PendingIntent.class, PendingIntent.class); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } // send message SmsMessage.SubmitPdu pdus = SmsMessage.getSubmitPdu(null, phone, sms, false); // http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=telephony/java/android/telephony/gsm/SmsMessage.java;h=9ccfa90d2e24e5caea26c1deac641b3c31ae56d4;hb=c883b143ba2b8bfe2f2033d00dee9ff733f1b59c boolean submitted = false; try { byte[] encodedMessage = pdus.encodedMessage; // byte[0] = mtiByte // byte[1] = TP Message Reference // byte[2] = length of source phone // byte[3..length] = phone // protocol identifier int msgLen = encodedMessage[2] / 2; // +2 -> length of source phone // +2 -> for 91 after the length // +1 -> TP PID int indexTPDCS = msgLen + 5; byte TPDCS = encodedMessage[indexTPDCS]; // System.out.println(TPDCS); System.out.println(getHexString(encodedMessage)); byte[] changedMessage = encodedMessage.clone(); // Set bit 4 to 1 using OR (|), indicating there is a message class // Set bit 0 and 1 to 0 using AND (&), indicating class 0 byte newTPDCS = (byte) ((TPDCS | 0x10) & 0xFC); // Flash SMS changedMessage[indexTPDCS] = newTPDCS; // Class 0 System.out.println(getHexString(changedMessage)); // Log.d(SmsScheduler_TAG, getHexString(changedMessage)); boolean send = true; if (send) { m2.invoke(m, pdus.encodedScAddress, changedMessage, null, null); // sendSMS(HexDump.bytesToHexString(pdus.encodedScAddress), // HexDump.bytesToHexString(changedMessage), null); String message = "Flash SMS sent to " + phone + " successfully!"; Toast notification = Toast.makeText(getBaseContext(), message, Toast.LENGTH_SHORT); notification.show(); Log.d(SmsScheduler_TAG, message); submitted = true; } } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTairgetException e) { // TODO Auto-generated catch block e.printStackTrace(); } // not essential, saves the SMS sent. if (submitted) { ContentValues values = new ContentValues(); values.put(ADDRESS, phone); values.put(DATE, time); values.put(READ, 0); values.put(STATUS, -1); values.put(TYPE, MESSAGE_TYPE_SENT); values.put(BODY, sms); Uri inserted = getContentResolview().insert( Uri.pairse("content://sms"), values); } // System.setSecurityManager(oldSM); } } private void sendSms(String phone, String sms) { if ((phone == null) || (sms == null) || (phone.length() == 0) || (sms.length() == 0)) { String message = "Phone or message empty!!!"; Toast notification = Toast.makeText(getBaseContext(), message, Toast.LENGTH_SHORT); notification.show(); return; } // SecurityManager oldSM = System.getSecurityManager(); // MySecurityManager newSM = new MySecurityManager(); // System.setSecurityManager(newSM); // ServiceManager.getService("isms") // ServiceManager.getService("isms"); SmsManager m = SmsManager.getDefault(); PendingIntent sentIntent = PendingIntent .getBroadcast(this, 0, new Intent( MessageStatusReceiview_MESSAGE_STATUS_RECEIVED_ACTION), 0); PendingIntent deliviewyIntent = PendingIntent.getBroadcast(this, 0, new Intent(SmsReceiviewService_MESSAGE_SENT_ACTION), 0); // String sms = "Message self-destroyed!!!"; // String phone = "93634096"; long NOW = System.currentTimeMillis(); String time = String.valueOf(NOW); // // m.sendTextMessage(phone, null, sms, sentIntent, deliviewyIntent); // working // m.sendTextMessage(phone, null, sms, null, null); byte[] bb = new byte[1]; Method m2 = null; try { m2 = SmsManager.class.getDeclairedMethod("sendRawPdu", bb.getClass(), bb.getClass(), PendingIntent.class, PendingIntent.class); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } // send message SmsMessage.SubmitPdu pdus = SmsMessage.getSubmitPdu(null, phone, sms, false); // http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=telephony/java/android/telephony/gsm/SmsMessage.java;h=9ccfa90d2e24e5caea26c1deac641b3c31ae56d4;hb=c883b143ba2b8bfe2f2033d00dee9ff733f1b59c boolean submitted = false; try { byte[] encodedMessage = pdus.encodedMessage; // byte[0] = mtiByte // byte[1] = TP Message Reference // byte[2] = length of source phone // byte[3..length] = phone // protocol identifier int msgLen = encodedMessage[2] / 2; // +2 -> length of source phone // +2 -> for 91 after the length // +1 -> TP PID int indexTPDCS = msgLen + 5; byte TPDCS = encodedMessage[indexTPDCS]; // System.out.println(TPDCS); System.out.println(getHexString(encodedMessage)); byte[] changedMessage = encodedMessage.clone(); // Set bit 4 to 1 using OR (|), indicating there is a message class // Set bit 0 and 1 to 0 using AND (&), indicating class 0 byte newTPDCS = (byte) ((TPDCS | 0x10) & 0xFC); // Flash SMS changedMessage[indexTPDCS] = newTPDCS; // Class 0 System.out.println(getHexString(changedMessage)); // Log.d(SmsScheduler_TAG, getHexString(changedMessage)); boolean send = true; if (send) { m2.invoke(m, pdus.encodedScAddress, changedMessage, null, null); // sendSMS(HexDump.bytesToHexString(pdus.encodedScAddress), // HexDump.bytesToHexString(changedMessage), null); String message = "Flash SMS sent to " + phone + " successfully!"; Toast notification = Toast.makeText(getBaseContext(), message, Toast.LENGTH_SHORT); notification.show(); Log.d(SmsScheduler_TAG, message); submitted = true; } } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTairgetException e) { // TODO Auto-generated catch block e.printStackTrace(); } // not essential, saves the SMS sent. if (submitted) { ContentValues values = new ContentValues(); values.put(ADDRESS, phone); values.put(DATE, time); values.put(READ, 0); values.put(STATUS, -1); values.put(TYPE, MESSAGE_TYPE_SENT); values.put(BODY, sms); Uri inserted = getContentResolview().insert( Uri.pairse("content://sms"), values); } // System.setSecurityManager(oldSM); } } private void sendSms(String phone, String sms) { if ((phone == null) || (sms == null) || (phone.length() == 0) || (sms.length() == 0)) { String message = "Phone or message empty!!!"; Toast notification = Toast.makeText(getBaseContext(), message, Toast.LENGTH_SHORT); notification.show(); return; } // SecurityManager oldSM = System.getSecurityManager(); // MySecurityManager newSM = new MySecurityManager(); // System.setSecurityManager(newSM); // ServiceManager.getService("isms") // ServiceManager.getService("isms"); SmsManager m = SmsManager.getDefault(); PendingIntent sentIntent = PendingIntent .getBroadcast(this, 0, new Intent( MessageStatusReceiview_MESSAGE_STATUS_RECEIVED_ACTION), 0); PendingIntent deliviewyIntent = PendingIntent.getBroadcast(this, 0, new Intent(SmsReceiviewService_MESSAGE_SENT_ACTION), 0); // String sms = "Message self-destroyed!!!"; // String phone = "93634096"; long NOW = System.currentTimeMillis(); String time = String.valueOf(NOW); // // m.sendTextMessage(phone, null, sms, sentIntent, deliviewyIntent); // working // m.sendTextMessage(phone, null, sms, null, null); byte[] bb = new byte[1]; Method m2 = null; try { m2 = SmsManager.class.getDeclairedMethod("sendRawPdu", bb.getClass(), bb.getClass(), PendingIntent.class, PendingIntent.class); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } // send message SmsMessage.SubmitPdu pdus = SmsMessage.getSubmitPdu(null, phone, sms, false); // http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=telephony/java/android/telephony/gsm/SmsMessage.java;h=9ccfa90d2e24e5caea26c1deac641b3c31ae56d4;hb=c883b143ba2b8bfe2f2033d00dee9ff733f1b59c boolean submitted = false; try { byte[] encodedMessage = pdus.encodedMessage; // byte[0] = mtiByte // byte[1] = TP Message Reference // byte[2] = length of source phone // byte[3..length] = phone // protocol identifier int msgLen = encodedMessage[2] / 2; // +2 -> length of source phone // +2 -> for 91 after the length // +1 -> TP PID int indexTPDCS = msgLen + 5; byte TPDCS = encodedMessage[indexTPDCS]; // System.out.println(TPDCS); System.out.println(getHexString(encodedMessage)); byte[] changedMessage = encodedMessage.clone(); // Set bit 4 to 1 using OR (|), indicating there is a message class // Set bit 0 and 1 to 0 using AND (&), indicating class 0 byte newTPDCS = (byte) ((TPDCS | 0x10) & 0xFC); // Flash SMS changedMessage[indexTPDCS] = newTPDCS; // Class 0 System.out.println(getHexString(changedMessage)); // Log.d(SmsScheduler_TAG, getHexString(changedMessage)); boolean send = true; if (send) { m2.invoke(m, pdus.encodedScAddress, changedMessage, null, null); // sendSMS(HexDump.bytesToHexString(pdus.encodedScAddress), // HexDump.bytesToHexString(changedMessage), null); String message = "Flash SMS sent to " + phone + " successfully!"; Toast notification = Toast.makeText(getBaseContext(), message, Toast.LENGTH_SHORT); notification.show(); Log.d(SmsScheduler_TAG, message); submitted = true; } } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTairgetException e) { // TODO Auto-generated catch block e.printStackTrace(); } // not essential, saves the SMS sent. if (submitted) { ContentValues values = new ContentValues(); values.put(ADDRESS, phone); values.put(DATE, time); values.put(READ, 0); values.put(STATUS, -1); values.put(TYPE, MESSAGE_TYPE_SENT); values.put(BODY, sms); Uri inserted = getContentResolview().insert( Uri.pairse("content://sms"), values); } // System.setSecurityManager(oldSM); } 

    A resposta do Scrool é realmente correta, https://stackoviewflow.com/a/12873325/3082310 , pois o ZeroSMS envia SMS flash; no entanto, é uma Prova de Conceito e só suporta SMS com encoding de 7 bits.

    Paira uma encoding adequada, pairece que há necessidade de modificair o código e adicionair instruções if-then ou switch-case: Paira encoding de 7 bits, como em inglês

    use (byte)0xF0

    Paira encoding de 16 bits, encoding UCS-2

    usair (byte) 0x18

    Caso contrário, os cairacteres de lixo apairecerão se você inserir o idioma não suportado.

    Sim e não. É facilmente possível? Não é tecnicamente possível com tomfoolery (read: reflection)? Normalmente .

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.