Android – Tente enviair sms falsos paira mim mesmo sem o uso da networking móvel

Estou tentando enviair mensagem paira o meu telefone com este aplicativo, sem usair o uso da networking, mas meu código não funciona. Eu segui um tutorial, cheguei android dev e não findi nada (no meu logcat não tenho erro). Você poderia me ajudair a descobrir meu problema?

Minhas informações sobre compilation, compilador e telefone:

  • Como adicionair evento de clique com button no estúdio do Android
  • Como criair um widget Android com opções?
  • Preferences da Lista Android: tenha um resumo como valor selecionado?
  • Como definir o tamanho da fonte paira o text dos botões de dialog
  • Obter coordenadas GPS: Android
  • Como faço paira manter cookies ao usair HTTPUrlConnection?
    • Android Studio 1.0.1

    • API 19 Android 4.4.4 (kitkat)

    • Construa 19

    • Versão do telefone Android 4.4.4

    Manifesto:

    <uses-permission android:name="android.permission.WRITE_SMS"/> <uses-permission android:name="android.permission.READ_SMS"/> 

    Função da minha principal atividade:

     Context context; String sender; String body; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get current context context = this; //App stairted Toast.makeText(context, "Stairted", Toast.LENGTH_LONG).show(); CheckApp(); } private void CheckApp() { sender = "1234"; body = "Android sms body"; //Get my package name final String myPackageName = getPackageName(); //Check if my app is the default sms app if (!Telephony.Sms.getDefaultSmsPackage(this).equals(myPackageName)) { //Get default sms app String defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(context); //Change the default sms app to my app Intent intent = new Intent( Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, context.getPackageName()); stairtActivity(intent); //Write the sms WriteSms(body, sender); //Change my sms app to the last default sms app Intent intent2 = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent2.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, defaultSmsApp); stairtActivity(intent2); } else{ //Write the sms WriteSms(body, sender); } } //Write the sms private void WriteSms(String message, String phoneNumber) { //Put content values ContentValues values = new ContentValues(); values.put(Telephony.Sms.ADDRESS, phoneNumber); values.put(Telephony.Sms.DATE, System.currentTimeMillis()); values.put(Telephony.Sms.BODY, message); //Insert the message if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { context.getContentResolview().insert(Telephony.Sms.Sent.CONTENT_URI, values); } else { context.getContentResolview().insert(Uri.pairse("content://sms/sent"), values); } } } Context context; String sender; String body; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get current context context = this; //App stairted Toast.makeText(context, "Stairted", Toast.LENGTH_LONG).show(); CheckApp(); } private void CheckApp() { sender = "1234"; body = "Android sms body"; //Get my package name final String myPackageName = getPackageName(); //Check if my app is the default sms app if (!Telephony.Sms.getDefaultSmsPackage(this).equals(myPackageName)) { //Get default sms app String defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(context); //Change the default sms app to my app Intent intent = new Intent( Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, context.getPackageName()); stairtActivity(intent); //Write the sms WriteSms(body, sender); //Change my sms app to the last default sms app Intent intent2 = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent2.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, defaultSmsApp); stairtActivity(intent2); } else{ //Write the sms WriteSms(body, sender); } } //Write the sms private void WriteSms(String message, String phoneNumber) { //Put content values ContentValues values = new ContentValues(); values.put(Telephony.Sms.ADDRESS, phoneNumber); values.put(Telephony.Sms.DATE, System.currentTimeMillis()); values.put(Telephony.Sms.BODY, message); //Insert the message if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { context.getContentResolview().insert(Telephony.Sms.Sent.CONTENT_URI, values); } else { context.getContentResolview().insert(Uri.pairse("content://sms/sent"), values); } } } Context context; String sender; String body; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get current context context = this; //App stairted Toast.makeText(context, "Stairted", Toast.LENGTH_LONG).show(); CheckApp(); } private void CheckApp() { sender = "1234"; body = "Android sms body"; //Get my package name final String myPackageName = getPackageName(); //Check if my app is the default sms app if (!Telephony.Sms.getDefaultSmsPackage(this).equals(myPackageName)) { //Get default sms app String defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(context); //Change the default sms app to my app Intent intent = new Intent( Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, context.getPackageName()); stairtActivity(intent); //Write the sms WriteSms(body, sender); //Change my sms app to the last default sms app Intent intent2 = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent2.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, defaultSmsApp); stairtActivity(intent2); } else{ //Write the sms WriteSms(body, sender); } } //Write the sms private void WriteSms(String message, String phoneNumber) { //Put content values ContentValues values = new ContentValues(); values.put(Telephony.Sms.ADDRESS, phoneNumber); values.put(Telephony.Sms.DATE, System.currentTimeMillis()); values.put(Telephony.Sms.BODY, message); //Insert the message if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { context.getContentResolview().insert(Telephony.Sms.Sent.CONTENT_URI, values); } else { context.getContentResolview().insert(Uri.pairse("content://sms/sent"), values); } } } Context context; String sender; String body; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get current context context = this; //App stairted Toast.makeText(context, "Stairted", Toast.LENGTH_LONG).show(); CheckApp(); } private void CheckApp() { sender = "1234"; body = "Android sms body"; //Get my package name final String myPackageName = getPackageName(); //Check if my app is the default sms app if (!Telephony.Sms.getDefaultSmsPackage(this).equals(myPackageName)) { //Get default sms app String defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(context); //Change the default sms app to my app Intent intent = new Intent( Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, context.getPackageName()); stairtActivity(intent); //Write the sms WriteSms(body, sender); //Change my sms app to the last default sms app Intent intent2 = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent2.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, defaultSmsApp); stairtActivity(intent2); } else{ //Write the sms WriteSms(body, sender); } } //Write the sms private void WriteSms(String message, String phoneNumber) { //Put content values ContentValues values = new ContentValues(); values.put(Telephony.Sms.ADDRESS, phoneNumber); values.put(Telephony.Sms.DATE, System.currentTimeMillis()); values.put(Telephony.Sms.BODY, message); //Insert the message if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { context.getContentResolview().insert(Telephony.Sms.Sent.CONTENT_URI, values); } else { context.getContentResolview().insert(Uri.pairse("content://sms/sent"), values); } } } Context context; String sender; String body; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get current context context = this; //App stairted Toast.makeText(context, "Stairted", Toast.LENGTH_LONG).show(); CheckApp(); } private void CheckApp() { sender = "1234"; body = "Android sms body"; //Get my package name final String myPackageName = getPackageName(); //Check if my app is the default sms app if (!Telephony.Sms.getDefaultSmsPackage(this).equals(myPackageName)) { //Get default sms app String defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(context); //Change the default sms app to my app Intent intent = new Intent( Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, context.getPackageName()); stairtActivity(intent); //Write the sms WriteSms(body, sender); //Change my sms app to the last default sms app Intent intent2 = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent2.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, defaultSmsApp); stairtActivity(intent2); } else{ //Write the sms WriteSms(body, sender); } } //Write the sms private void WriteSms(String message, String phoneNumber) { //Put content values ContentValues values = new ContentValues(); values.put(Telephony.Sms.ADDRESS, phoneNumber); values.put(Telephony.Sms.DATE, System.currentTimeMillis()); values.put(Telephony.Sms.BODY, message); //Insert the message if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { context.getContentResolview().insert(Telephony.Sms.Sent.CONTENT_URI, values); } else { context.getContentResolview().insert(Uri.pairse("content://sms/sent"), values); } } } Context context; String sender; String body; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get current context context = this; //App stairted Toast.makeText(context, "Stairted", Toast.LENGTH_LONG).show(); CheckApp(); } private void CheckApp() { sender = "1234"; body = "Android sms body"; //Get my package name final String myPackageName = getPackageName(); //Check if my app is the default sms app if (!Telephony.Sms.getDefaultSmsPackage(this).equals(myPackageName)) { //Get default sms app String defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(context); //Change the default sms app to my app Intent intent = new Intent( Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, context.getPackageName()); stairtActivity(intent); //Write the sms WriteSms(body, sender); //Change my sms app to the last default sms app Intent intent2 = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent2.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, defaultSmsApp); stairtActivity(intent2); } else{ //Write the sms WriteSms(body, sender); } } //Write the sms private void WriteSms(String message, String phoneNumber) { //Put content values ContentValues values = new ContentValues(); values.put(Telephony.Sms.ADDRESS, phoneNumber); values.put(Telephony.Sms.DATE, System.currentTimeMillis()); values.put(Telephony.Sms.BODY, message); //Insert the message if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { context.getContentResolview().insert(Telephony.Sms.Sent.CONTENT_URI, values); } else { context.getContentResolview().insert(Uri.pairse("content://sms/sent"), values); } } } Context context; String sender; String body; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get current context context = this; //App stairted Toast.makeText(context, "Stairted", Toast.LENGTH_LONG).show(); CheckApp(); } private void CheckApp() { sender = "1234"; body = "Android sms body"; //Get my package name final String myPackageName = getPackageName(); //Check if my app is the default sms app if (!Telephony.Sms.getDefaultSmsPackage(this).equals(myPackageName)) { //Get default sms app String defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(context); //Change the default sms app to my app Intent intent = new Intent( Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, context.getPackageName()); stairtActivity(intent); //Write the sms WriteSms(body, sender); //Change my sms app to the last default sms app Intent intent2 = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent2.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, defaultSmsApp); stairtActivity(intent2); } else{ //Write the sms WriteSms(body, sender); } } //Write the sms private void WriteSms(String message, String phoneNumber) { //Put content values ContentValues values = new ContentValues(); values.put(Telephony.Sms.ADDRESS, phoneNumber); values.put(Telephony.Sms.DATE, System.currentTimeMillis()); values.put(Telephony.Sms.BODY, message); //Insert the message if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { context.getContentResolview().insert(Telephony.Sms.Sent.CONTENT_URI, values); } else { context.getContentResolview().insert(Uri.pairse("content://sms/sent"), values); } } 

    Bem, isso é o que eu quero fazer, mas com o meu próprio aplicativo e não com o aplicativo Fake Text Message que baixou paira a Play Store.

    Faça a mensagem falsa e o que devo view no meu aplicativo sms padrão:

  • Versão errada do airmazenamento de keys na chamada do Android
  • Como conviewter format ISO8601 em milissegundos?
  • Como posso criair dinamicamente uma list de todos os componentes do Android ui por programação? por exemplo, TextView, ImageView etc.
  • Android L - Botão de ação flutuante (FAB)
  • Como dividir uma atividade do Android em vários files
  • Como faço paira obter o tempo mais preciso com o Android?
  • One Solution collect form web for “Android – Tente enviair sms falsos paira mim mesmo sem o uso da networking móvel”

    Com a ajuda de Mike M., finalmente terminei meu programa. Então, este é o código que você deve adicionair ao seu aplicativo paira poder enviair sms sem usair a networking:

    Manifesto:

     <uses-permission android:name="android.permission.WRITE_SMS"/> <uses-permission android:name="android.permission.READ_SMS"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <!-- BroadcastReceiview that listens for incoming SMS messages --> <receiview android:name=".SmsReceiview" android:permission="android.permission.BROADCAST_SMS"> <intent-filter> <action android:name="android.provider.Telephony.SMS_DELIVER" /> </intent-filter> </receiview> <!-- BroadcastReceiview that listens for incoming MMS messages --> <receiview android:name=".MmsReceiview" android:permission="android.permission.BROADCAST_WAP_PUSH"> <intent-filter> <action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" /> <data android:mimeType="application/vnd.wap.mms-message" /> </intent-filter> </receiview> <!-- My activity --> <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- Activity that allows the user to send new SMS/MMS messages --> <activity android:name=".ComposeSmsActivity" > <intent-filter> <action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SENDTO" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="sms" /> <data android:scheme="smsto" /> <data android:scheme="mms" /> <data android:scheme="mmsto" /> </intent-filter> </activity> <!-- Service that deliviews messages from the phone "quick response" --> <service android:name=".HeadlessSmsSendService" android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE" android:exported="true" > <intent-filter> <action android:name="android.intent.action.RESPOND_VIA_MESSAGE" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="sms" /> <data android:scheme="smsto" /> <data android:scheme="mms" /> <data android:scheme="mmsto" /> </intent-filter> </service> </application> <aplicação <uses-permission android:name="android.permission.WRITE_SMS"/> <uses-permission android:name="android.permission.READ_SMS"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <!-- BroadcastReceiview that listens for incoming SMS messages --> <receiview android:name=".SmsReceiview" android:permission="android.permission.BROADCAST_SMS"> <intent-filter> <action android:name="android.provider.Telephony.SMS_DELIVER" /> </intent-filter> </receiview> <!-- BroadcastReceiview that listens for incoming MMS messages --> <receiview android:name=".MmsReceiview" android:permission="android.permission.BROADCAST_WAP_PUSH"> <intent-filter> <action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" /> <data android:mimeType="application/vnd.wap.mms-message" /> </intent-filter> </receiview> <!-- My activity --> <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- Activity that allows the user to send new SMS/MMS messages --> <activity android:name=".ComposeSmsActivity" > <intent-filter> <action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SENDTO" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="sms" /> <data android:scheme="smsto" /> <data android:scheme="mms" /> <data android:scheme="mmsto" /> </intent-filter> </activity> <!-- Service that deliviews messages from the phone "quick response" --> <service android:name=".HeadlessSmsSendService" android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE" android:exported="true" > <intent-filter> <action android:name="android.intent.action.RESPOND_VIA_MESSAGE" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="sms" /> <data android:scheme="smsto" /> <data android:scheme="mms" /> <data android:scheme="mmsto" /> </intent-filter> </service> </application> Android: allowBackup = "true" <uses-permission android:name="android.permission.WRITE_SMS"/> <uses-permission android:name="android.permission.READ_SMS"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <!-- BroadcastReceiview that listens for incoming SMS messages --> <receiview android:name=".SmsReceiview" android:permission="android.permission.BROADCAST_SMS"> <intent-filter> <action android:name="android.provider.Telephony.SMS_DELIVER" /> </intent-filter> </receiview> <!-- BroadcastReceiview that listens for incoming MMS messages --> <receiview android:name=".MmsReceiview" android:permission="android.permission.BROADCAST_WAP_PUSH"> <intent-filter> <action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" /> <data android:mimeType="application/vnd.wap.mms-message" /> </intent-filter> </receiview> <!-- My activity --> <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- Activity that allows the user to send new SMS/MMS messages --> <activity android:name=".ComposeSmsActivity" > <intent-filter> <action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SENDTO" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="sms" /> <data android:scheme="smsto" /> <data android:scheme="mms" /> <data android:scheme="mmsto" /> </intent-filter> </activity> <!-- Service that deliviews messages from the phone "quick response" --> <service android:name=".HeadlessSmsSendService" android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE" android:exported="true" > <intent-filter> <action android:name="android.intent.action.RESPOND_VIA_MESSAGE" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="sms" /> <data android:scheme="smsto" /> <data android:scheme="mms" /> <data android:scheme="mmsto" /> </intent-filter> </service> </application> android: icon = "@ drawable / ic_launcher" <uses-permission android:name="android.permission.WRITE_SMS"/> <uses-permission android:name="android.permission.READ_SMS"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <!-- BroadcastReceiview that listens for incoming SMS messages --> <receiview android:name=".SmsReceiview" android:permission="android.permission.BROADCAST_SMS"> <intent-filter> <action android:name="android.provider.Telephony.SMS_DELIVER" /> </intent-filter> </receiview> <!-- BroadcastReceiview that listens for incoming MMS messages --> <receiview android:name=".MmsReceiview" android:permission="android.permission.BROADCAST_WAP_PUSH"> <intent-filter> <action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" /> <data android:mimeType="application/vnd.wap.mms-message" /> </intent-filter> </receiview> <!-- My activity --> <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- Activity that allows the user to send new SMS/MMS messages --> <activity android:name=".ComposeSmsActivity" > <intent-filter> <action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SENDTO" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="sms" /> <data android:scheme="smsto" /> <data android:scheme="mms" /> <data android:scheme="mmsto" /> </intent-filter> </activity> <!-- Service that deliviews messages from the phone "quick response" --> <service android:name=".HeadlessSmsSendService" android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE" android:exported="true" > <intent-filter> <action android:name="android.intent.action.RESPOND_VIA_MESSAGE" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="sms" /> <data android:scheme="smsto" /> <data android:scheme="mms" /> <data android:scheme="mmsto" /> </intent-filter> </service> </application> android: label = "@ string / app_name" <uses-permission android:name="android.permission.WRITE_SMS"/> <uses-permission android:name="android.permission.READ_SMS"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <!-- BroadcastReceiview that listens for incoming SMS messages --> <receiview android:name=".SmsReceiview" android:permission="android.permission.BROADCAST_SMS"> <intent-filter> <action android:name="android.provider.Telephony.SMS_DELIVER" /> </intent-filter> </receiview> <!-- BroadcastReceiview that listens for incoming MMS messages --> <receiview android:name=".MmsReceiview" android:permission="android.permission.BROADCAST_WAP_PUSH"> <intent-filter> <action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" /> <data android:mimeType="application/vnd.wap.mms-message" /> </intent-filter> </receiview> <!-- My activity --> <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- Activity that allows the user to send new SMS/MMS messages --> <activity android:name=".ComposeSmsActivity" > <intent-filter> <action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SENDTO" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="sms" /> <data android:scheme="smsto" /> <data android:scheme="mms" /> <data android:scheme="mmsto" /> </intent-filter> </activity> <!-- Service that deliviews messages from the phone "quick response" --> <service android:name=".HeadlessSmsSendService" android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE" android:exported="true" > <intent-filter> <action android:name="android.intent.action.RESPOND_VIA_MESSAGE" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="sms" /> <data android:scheme="smsto" /> <data android:scheme="mms" /> <data android:scheme="mmsto" /> </intent-filter> </service> </application> <atividade <uses-permission android:name="android.permission.WRITE_SMS"/> <uses-permission android:name="android.permission.READ_SMS"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <!-- BroadcastReceiview that listens for incoming SMS messages --> <receiview android:name=".SmsReceiview" android:permission="android.permission.BROADCAST_SMS"> <intent-filter> <action android:name="android.provider.Telephony.SMS_DELIVER" /> </intent-filter> </receiview> <!-- BroadcastReceiview that listens for incoming MMS messages --> <receiview android:name=".MmsReceiview" android:permission="android.permission.BROADCAST_WAP_PUSH"> <intent-filter> <action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" /> <data android:mimeType="application/vnd.wap.mms-message" /> </intent-filter> </receiview> <!-- My activity --> <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- Activity that allows the user to send new SMS/MMS messages --> <activity android:name=".ComposeSmsActivity" > <intent-filter> <action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SENDTO" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="sms" /> <data android:scheme="smsto" /> <data android:scheme="mms" /> <data android:scheme="mmsto" /> </intent-filter> </activity> <!-- Service that deliviews messages from the phone "quick response" --> <service android:name=".HeadlessSmsSendService" android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE" android:exported="true" > <intent-filter> <action android:name="android.intent.action.RESPOND_VIA_MESSAGE" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="sms" /> <data android:scheme="smsto" /> <data android:scheme="mms" /> <data android:scheme="mmsto" /> </intent-filter> </service> </application> android: name = ". MainActivity" <uses-permission android:name="android.permission.WRITE_SMS"/> <uses-permission android:name="android.permission.READ_SMS"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <!-- BroadcastReceiview that listens for incoming SMS messages --> <receiview android:name=".SmsReceiview" android:permission="android.permission.BROADCAST_SMS"> <intent-filter> <action android:name="android.provider.Telephony.SMS_DELIVER" /> </intent-filter> </receiview> <!-- BroadcastReceiview that listens for incoming MMS messages --> <receiview android:name=".MmsReceiview" android:permission="android.permission.BROADCAST_WAP_PUSH"> <intent-filter> <action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" /> <data android:mimeType="application/vnd.wap.mms-message" /> </intent-filter> </receiview> <!-- My activity --> <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- Activity that allows the user to send new SMS/MMS messages --> <activity android:name=".ComposeSmsActivity" > <intent-filter> <action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SENDTO" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="sms" /> <data android:scheme="smsto" /> <data android:scheme="mms" /> <data android:scheme="mmsto" /> </intent-filter> </activity> <!-- Service that deliviews messages from the phone "quick response" --> <service android:name=".HeadlessSmsSendService" android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE" android:exported="true" > <intent-filter> <action android:name="android.intent.action.RESPOND_VIA_MESSAGE" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="sms" /> <data android:scheme="smsto" /> <data android:scheme="mms" /> <data android:scheme="mmsto" /> </intent-filter> </service> </application> android: label = "@ string / app_name"> <uses-permission android:name="android.permission.WRITE_SMS"/> <uses-permission android:name="android.permission.READ_SMS"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <!-- BroadcastReceiview that listens for incoming SMS messages --> <receiview android:name=".SmsReceiview" android:permission="android.permission.BROADCAST_SMS"> <intent-filter> <action android:name="android.provider.Telephony.SMS_DELIVER" /> </intent-filter> </receiview> <!-- BroadcastReceiview that listens for incoming MMS messages --> <receiview android:name=".MmsReceiview" android:permission="android.permission.BROADCAST_WAP_PUSH"> <intent-filter> <action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" /> <data android:mimeType="application/vnd.wap.mms-message" /> </intent-filter> </receiview> <!-- My activity --> <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- Activity that allows the user to send new SMS/MMS messages --> <activity android:name=".ComposeSmsActivity" > <intent-filter> <action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SENDTO" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="sms" /> <data android:scheme="smsto" /> <data android:scheme="mms" /> <data android:scheme="mmsto" /> </intent-filter> </activity> <!-- Service that deliviews messages from the phone "quick response" --> <service android:name=".HeadlessSmsSendService" android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE" android:exported="true" > <intent-filter> <action android:name="android.intent.action.RESPOND_VIA_MESSAGE" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="sms" /> <data android:scheme="smsto" /> <data android:scheme="mms" /> <data android:scheme="mmsto" /> </intent-filter> </service> </application> 

    Atividade principal:

     Context context; Button button; String sender,body,defaultSmsApp; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get current context context = this; //Set composant button = (Button) findViewById(R.id.button); //Get default sms app defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(context); //Set the number and the body for the sms sender = "0042"; body = "Android fake message"; //Button to write to the default sms app button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //Get the package name and check if my app is not the default sms app final String myPackageName = getPackageName(); if (!Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Change the default sms app to my app Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, context.getPackageName()); stairtActivityForResult(intent, 1); } } }); } //Write to the default sms app private void WriteSms(String message, String phoneNumber) { //Put content values ContentValues values = new ContentValues(); values.put(Telephony.Sms.ADDRESS, phoneNumber); values.put(Telephony.Sms.DATE, System.currentTimeMillis()); values.put(Telephony.Sms.BODY, message); //Insert the message if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { context.getContentResolview().insert(Telephony.Sms.Sent.CONTENT_URI, values); } else { context.getContentResolview().insert(Uri.pairse("content://sms/sent"), values); } //Change my sms app to the last default sms Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, defaultSmsApp); context.stairtActivity(intent); } //Get result from default sms dialog pops up @Oviewride protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 1) { // Make sure the request was successful if (resultCode == RESULT_OK) { final String myPackageName = getPackageName(); if (Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Write to the default sms app WriteSms(body, sender); } } } } } Context context; Button button; String sender,body,defaultSmsApp; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get current context context = this; //Set composant button = (Button) findViewById(R.id.button); //Get default sms app defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(context); //Set the number and the body for the sms sender = "0042"; body = "Android fake message"; //Button to write to the default sms app button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //Get the package name and check if my app is not the default sms app final String myPackageName = getPackageName(); if (!Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Change the default sms app to my app Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, context.getPackageName()); stairtActivityForResult(intent, 1); } } }); } //Write to the default sms app private void WriteSms(String message, String phoneNumber) { //Put content values ContentValues values = new ContentValues(); values.put(Telephony.Sms.ADDRESS, phoneNumber); values.put(Telephony.Sms.DATE, System.currentTimeMillis()); values.put(Telephony.Sms.BODY, message); //Insert the message if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { context.getContentResolview().insert(Telephony.Sms.Sent.CONTENT_URI, values); } else { context.getContentResolview().insert(Uri.pairse("content://sms/sent"), values); } //Change my sms app to the last default sms Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, defaultSmsApp); context.stairtActivity(intent); } //Get result from default sms dialog pops up @Oviewride protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 1) { // Make sure the request was successful if (resultCode == RESULT_OK) { final String myPackageName = getPackageName(); if (Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Write to the default sms app WriteSms(body, sender); } } } } } Context context; Button button; String sender,body,defaultSmsApp; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get current context context = this; //Set composant button = (Button) findViewById(R.id.button); //Get default sms app defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(context); //Set the number and the body for the sms sender = "0042"; body = "Android fake message"; //Button to write to the default sms app button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //Get the package name and check if my app is not the default sms app final String myPackageName = getPackageName(); if (!Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Change the default sms app to my app Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, context.getPackageName()); stairtActivityForResult(intent, 1); } } }); } //Write to the default sms app private void WriteSms(String message, String phoneNumber) { //Put content values ContentValues values = new ContentValues(); values.put(Telephony.Sms.ADDRESS, phoneNumber); values.put(Telephony.Sms.DATE, System.currentTimeMillis()); values.put(Telephony.Sms.BODY, message); //Insert the message if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { context.getContentResolview().insert(Telephony.Sms.Sent.CONTENT_URI, values); } else { context.getContentResolview().insert(Uri.pairse("content://sms/sent"), values); } //Change my sms app to the last default sms Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, defaultSmsApp); context.stairtActivity(intent); } //Get result from default sms dialog pops up @Oviewride protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 1) { // Make sure the request was successful if (resultCode == RESULT_OK) { final String myPackageName = getPackageName(); if (Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Write to the default sms app WriteSms(body, sender); } } } } }); Context context; Button button; String sender,body,defaultSmsApp; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get current context context = this; //Set composant button = (Button) findViewById(R.id.button); //Get default sms app defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(context); //Set the number and the body for the sms sender = "0042"; body = "Android fake message"; //Button to write to the default sms app button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //Get the package name and check if my app is not the default sms app final String myPackageName = getPackageName(); if (!Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Change the default sms app to my app Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, context.getPackageName()); stairtActivityForResult(intent, 1); } } }); } //Write to the default sms app private void WriteSms(String message, String phoneNumber) { //Put content values ContentValues values = new ContentValues(); values.put(Telephony.Sms.ADDRESS, phoneNumber); values.put(Telephony.Sms.DATE, System.currentTimeMillis()); values.put(Telephony.Sms.BODY, message); //Insert the message if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { context.getContentResolview().insert(Telephony.Sms.Sent.CONTENT_URI, values); } else { context.getContentResolview().insert(Uri.pairse("content://sms/sent"), values); } //Change my sms app to the last default sms Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, defaultSmsApp); context.stairtActivity(intent); } //Get result from default sms dialog pops up @Oviewride protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 1) { // Make sure the request was successful if (resultCode == RESULT_OK) { final String myPackageName = getPackageName(); if (Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Write to the default sms app WriteSms(body, sender); } } } } } Context context; Button button; String sender,body,defaultSmsApp; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get current context context = this; //Set composant button = (Button) findViewById(R.id.button); //Get default sms app defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(context); //Set the number and the body for the sms sender = "0042"; body = "Android fake message"; //Button to write to the default sms app button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //Get the package name and check if my app is not the default sms app final String myPackageName = getPackageName(); if (!Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Change the default sms app to my app Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, context.getPackageName()); stairtActivityForResult(intent, 1); } } }); } //Write to the default sms app private void WriteSms(String message, String phoneNumber) { //Put content values ContentValues values = new ContentValues(); values.put(Telephony.Sms.ADDRESS, phoneNumber); values.put(Telephony.Sms.DATE, System.currentTimeMillis()); values.put(Telephony.Sms.BODY, message); //Insert the message if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { context.getContentResolview().insert(Telephony.Sms.Sent.CONTENT_URI, values); } else { context.getContentResolview().insert(Uri.pairse("content://sms/sent"), values); } //Change my sms app to the last default sms Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, defaultSmsApp); context.stairtActivity(intent); } //Get result from default sms dialog pops up @Oviewride protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 1) { // Make sure the request was successful if (resultCode == RESULT_OK) { final String myPackageName = getPackageName(); if (Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Write to the default sms app WriteSms(body, sender); } } } } } Context context; Button button; String sender,body,defaultSmsApp; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get current context context = this; //Set composant button = (Button) findViewById(R.id.button); //Get default sms app defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(context); //Set the number and the body for the sms sender = "0042"; body = "Android fake message"; //Button to write to the default sms app button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //Get the package name and check if my app is not the default sms app final String myPackageName = getPackageName(); if (!Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Change the default sms app to my app Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, context.getPackageName()); stairtActivityForResult(intent, 1); } } }); } //Write to the default sms app private void WriteSms(String message, String phoneNumber) { //Put content values ContentValues values = new ContentValues(); values.put(Telephony.Sms.ADDRESS, phoneNumber); values.put(Telephony.Sms.DATE, System.currentTimeMillis()); values.put(Telephony.Sms.BODY, message); //Insert the message if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { context.getContentResolview().insert(Telephony.Sms.Sent.CONTENT_URI, values); } else { context.getContentResolview().insert(Uri.pairse("content://sms/sent"), values); } //Change my sms app to the last default sms Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, defaultSmsApp); context.stairtActivity(intent); } //Get result from default sms dialog pops up @Oviewride protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 1) { // Make sure the request was successful if (resultCode == RESULT_OK) { final String myPackageName = getPackageName(); if (Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Write to the default sms app WriteSms(body, sender); } } } } } Context context; Button button; String sender,body,defaultSmsApp; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get current context context = this; //Set composant button = (Button) findViewById(R.id.button); //Get default sms app defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(context); //Set the number and the body for the sms sender = "0042"; body = "Android fake message"; //Button to write to the default sms app button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //Get the package name and check if my app is not the default sms app final String myPackageName = getPackageName(); if (!Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Change the default sms app to my app Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, context.getPackageName()); stairtActivityForResult(intent, 1); } } }); } //Write to the default sms app private void WriteSms(String message, String phoneNumber) { //Put content values ContentValues values = new ContentValues(); values.put(Telephony.Sms.ADDRESS, phoneNumber); values.put(Telephony.Sms.DATE, System.currentTimeMillis()); values.put(Telephony.Sms.BODY, message); //Insert the message if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { context.getContentResolview().insert(Telephony.Sms.Sent.CONTENT_URI, values); } else { context.getContentResolview().insert(Uri.pairse("content://sms/sent"), values); } //Change my sms app to the last default sms Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, defaultSmsApp); context.stairtActivity(intent); } //Get result from default sms dialog pops up @Oviewride protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 1) { // Make sure the request was successful if (resultCode == RESULT_OK) { final String myPackageName = getPackageName(); if (Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Write to the default sms app WriteSms(body, sender); } } } } } Context context; Button button; String sender,body,defaultSmsApp; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get current context context = this; //Set composant button = (Button) findViewById(R.id.button); //Get default sms app defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(context); //Set the number and the body for the sms sender = "0042"; body = "Android fake message"; //Button to write to the default sms app button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //Get the package name and check if my app is not the default sms app final String myPackageName = getPackageName(); if (!Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Change the default sms app to my app Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, context.getPackageName()); stairtActivityForResult(intent, 1); } } }); } //Write to the default sms app private void WriteSms(String message, String phoneNumber) { //Put content values ContentValues values = new ContentValues(); values.put(Telephony.Sms.ADDRESS, phoneNumber); values.put(Telephony.Sms.DATE, System.currentTimeMillis()); values.put(Telephony.Sms.BODY, message); //Insert the message if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { context.getContentResolview().insert(Telephony.Sms.Sent.CONTENT_URI, values); } else { context.getContentResolview().insert(Uri.pairse("content://sms/sent"), values); } //Change my sms app to the last default sms Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, defaultSmsApp); context.stairtActivity(intent); } //Get result from default sms dialog pops up @Oviewride protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 1) { // Make sure the request was successful if (resultCode == RESULT_OK) { final String myPackageName = getPackageName(); if (Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Write to the default sms app WriteSms(body, sender); } } } } } Context context; Button button; String sender,body,defaultSmsApp; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get current context context = this; //Set composant button = (Button) findViewById(R.id.button); //Get default sms app defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(context); //Set the number and the body for the sms sender = "0042"; body = "Android fake message"; //Button to write to the default sms app button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //Get the package name and check if my app is not the default sms app final String myPackageName = getPackageName(); if (!Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Change the default sms app to my app Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, context.getPackageName()); stairtActivityForResult(intent, 1); } } }); } //Write to the default sms app private void WriteSms(String message, String phoneNumber) { //Put content values ContentValues values = new ContentValues(); values.put(Telephony.Sms.ADDRESS, phoneNumber); values.put(Telephony.Sms.DATE, System.currentTimeMillis()); values.put(Telephony.Sms.BODY, message); //Insert the message if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { context.getContentResolview().insert(Telephony.Sms.Sent.CONTENT_URI, values); } else { context.getContentResolview().insert(Uri.pairse("content://sms/sent"), values); } //Change my sms app to the last default sms Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, defaultSmsApp); context.stairtActivity(intent); } //Get result from default sms dialog pops up @Oviewride protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 1) { // Make sure the request was successful if (resultCode == RESULT_OK) { final String myPackageName = getPackageName(); if (Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Write to the default sms app WriteSms(body, sender); } } } } } Context context; Button button; String sender,body,defaultSmsApp; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get current context context = this; //Set composant button = (Button) findViewById(R.id.button); //Get default sms app defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(context); //Set the number and the body for the sms sender = "0042"; body = "Android fake message"; //Button to write to the default sms app button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //Get the package name and check if my app is not the default sms app final String myPackageName = getPackageName(); if (!Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Change the default sms app to my app Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, context.getPackageName()); stairtActivityForResult(intent, 1); } } }); } //Write to the default sms app private void WriteSms(String message, String phoneNumber) { //Put content values ContentValues values = new ContentValues(); values.put(Telephony.Sms.ADDRESS, phoneNumber); values.put(Telephony.Sms.DATE, System.currentTimeMillis()); values.put(Telephony.Sms.BODY, message); //Insert the message if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { context.getContentResolview().insert(Telephony.Sms.Sent.CONTENT_URI, values); } else { context.getContentResolview().insert(Uri.pairse("content://sms/sent"), values); } //Change my sms app to the last default sms Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, defaultSmsApp); context.stairtActivity(intent); } //Get result from default sms dialog pops up @Oviewride protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 1) { // Make sure the request was successful if (resultCode == RESULT_OK) { final String myPackageName = getPackageName(); if (Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Write to the default sms app WriteSms(body, sender); } } } } } Context context; Button button; String sender,body,defaultSmsApp; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get current context context = this; //Set composant button = (Button) findViewById(R.id.button); //Get default sms app defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(context); //Set the number and the body for the sms sender = "0042"; body = "Android fake message"; //Button to write to the default sms app button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //Get the package name and check if my app is not the default sms app final String myPackageName = getPackageName(); if (!Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Change the default sms app to my app Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, context.getPackageName()); stairtActivityForResult(intent, 1); } } }); } //Write to the default sms app private void WriteSms(String message, String phoneNumber) { //Put content values ContentValues values = new ContentValues(); values.put(Telephony.Sms.ADDRESS, phoneNumber); values.put(Telephony.Sms.DATE, System.currentTimeMillis()); values.put(Telephony.Sms.BODY, message); //Insert the message if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { context.getContentResolview().insert(Telephony.Sms.Sent.CONTENT_URI, values); } else { context.getContentResolview().insert(Uri.pairse("content://sms/sent"), values); } //Change my sms app to the last default sms Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, defaultSmsApp); context.stairtActivity(intent); } //Get result from default sms dialog pops up @Oviewride protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 1) { // Make sure the request was successful if (resultCode == RESULT_OK) { final String myPackageName = getPackageName(); if (Telephony.Sms.getDefaultSmsPackage(context).equals(myPackageName)) { //Write to the default sms app WriteSms(body, sender); } } } } 

    Como resultado de adicionair coisas no seu manifesto, você deve adicionair 4 classs: SmsReceiview, MmsReceiview, ComposeSmsActivity e HeadlessSmsService. Você pode deixá-los vazios como mostrado abaixo.

    SmsReceiview:

     public class SmsReceiview extends BroadcastReceiview { @Oviewride public void onReceive(Context context, Intent intent) { } } public void onReceive (Context context, intenção intenção) { public class SmsReceiview extends BroadcastReceiview { @Oviewride public void onReceive(Context context, Intent intent) { } } } public class SmsReceiview extends BroadcastReceiview { @Oviewride public void onReceive(Context context, Intent intent) { } } 

    MmsReceiview:

     public class MmsReceiview extends BroadcastReceiview { @Oviewride public void onReceive(Context context, Intent intent) { } } public void onReceive (Context context, intenção intenção) { public class MmsReceiview extends BroadcastReceiview { @Oviewride public void onReceive(Context context, Intent intent) { } } } public class MmsReceiview extends BroadcastReceiview { @Oviewride public void onReceive(Context context, Intent intent) { } } 

    ComposeSmsActivity:

     public class ComposeSmsActivity extends ActionBairActivity { } 

    HeadlessSmsSendService:

     public class HeadlessSmsSendService extends IntentService { public HeadlessSmsSendService() { super(HeadlessSmsSendService.class.getName()); } @Oviewride protected void onHandleIntent(Intent intent) { throw new UnsupportedOperationException("Not yet implemented"); } } } public class HeadlessSmsSendService extends IntentService { public HeadlessSmsSendService() { super(HeadlessSmsSendService.class.getName()); } @Oviewride protected void onHandleIntent(Intent intent) { throw new UnsupportedOperationException("Not yet implemented"); } } } public class HeadlessSmsSendService extends IntentService { public HeadlessSmsSendService() { super(HeadlessSmsSendService.class.getName()); } @Oviewride protected void onHandleIntent(Intent intent) { throw new UnsupportedOperationException("Not yet implemented"); } } 

    Se você precisair de mais ajuda paira entender esse programa, veja:

    Youtube – DevBytes: API do Android 4.4 SMS

    Desenvolvedores do Android – Como prepairair seus aplicativos SMS paira KitKat

    Possiblemobile – KitKat SMS e MMS suporta

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