Note that there are some explanatory texts on larger screens.

plurals
  1. POShowing Send SMS in the default Message Viewer in android
    primarykey
    data
    text
    <p>I have created an app that analyses the SMS that are being received and send messages back to the the Sender. But those SMS which are being send by my phone automatically are not shown in the default message viewer. How to get it done??</p> <p>This is the code i use to send SMS</p> <pre><code>package com.lalsoft.janko; import java.util.Calendar; import android.content.BroadcastReceiver; import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.telephony.gsm.SmsManager; import android.telephony.gsm.SmsMessage; import android.util.Log; import android.view.View; public class SMSReceiver extends BroadcastReceiver { public String SendMsgBody; private static final String LOG_TAG = "SMSReactor"; @Override public void onReceive(Context context, Intent intent) { //---get the SMS message passed in--- Bundle bundle = intent.getExtras(); SmsMessage[] msgs = null; String str = ""; String PhNo=""; String MsgBody=""; if (bundle != null) { //---retrieve the SMS message received--- Object[] pdus = (Object[]) bundle.get("pdus"); msgs = new SmsMessage[pdus.length]; for (int i=0; i&lt;msgs.length; i++) { msgs[i] = SmsMessage.createFromPdu((byte[])pdus[i]); str += "SMS from " + msgs[i].getOriginatingAddress(); PhNo=msgs[i].getOriginatingAddress(); str += " :"; str += msgs[i].getMessageBody().toString(); MsgBody=msgs[i].getMessageBody().toString(); str += "\n"; } if(MsgBody.equalsIgnoreCase("Test")) { SendSMS(PhNo,"Got you!!...Missile Launch initiated.Your location has been traced and the missile will hit your place in approximatly 2 Mins.. ESCAPE!!"); //SendSMS2(PhNo,"Got you!!...Missile Launch initiated.Your location has been traced and the missile will hit your place in approximatly 2 Mins.. ESCAPE!!"); } } /* public void SendSMS2(String phonenumber,String message) { startActivity(new Intent(Intent.ACTION_VIEW,Uri.fromParts(message, phonenumber, null))); } */ private void SendSMS(String phonenumber,String message) { SmsManager manager = SmsManager.getDefault(); manager.sendTextMessage(phonenumber, null, message, null, null); } } </code></pre> <p>Here on receiving an SMS with "test" written on it, my application sends the SMS back t o the sender..but in this SendSMS method, its sending the SMS but the send Message is not showing in the native/default SMS Application. What should i do to make this SMS send by my phone back to the Sender being shown in the native SMS application.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload