I tried this code in my android application for the SMS message but it is not working , the application does not appear in the messaging list. Should I add something to make
I am providing you a detailed desc to do that in different case(with contacts, text shares etc).
Manifest Entry for you Message Activity
Now we have made a processIntentData method as shown below to be applied in Message Activity:
private void processIntentData(Intent intent)
{
if (null == intent) return;
if (Intent.ACTION_SENDTO.equals(intent.getAction())) {
//in the data i'll find the number of the destination
String destionationNumber = intent.getDataString();
destionationNumber = URLDecoder.decode(destionationNumber);
//clear the string
destionationNumber = destionationNumber.replace("-", "")
.replace("smsto:", "")
.replace("sms:", "");
//and set fields
mTxtDestination.setText(destionationNumber);
} else if (Intent.ACTION_SEND.equals(intent.getAction()) && "text/plain".equals(intent.getType())) {
//in the data i'll find the content of the message
String message = intent.getStringExtra(Intent.EXTRA_TEXT);
//clear the string
mTxtBody.setText(message);
}
}
Use as shown in Message Activity:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
mTxtDestination = (EditText) findViewById(R.id.actsendsms_txtDestination);
mTxtBody = (EditText) findViewById(R.id.actsendsms_txtMessage);
...
//executed when the application first runs
if (null == savedInstanceState) {
processIntentData(getIntent());
}
}
The attached snap for results: