launch sms application with an intent

To start launch the sms activity all you need is this: Intent sendIntent = new Intent(Intent.ACTION_VIEW); sendIntent.setData(Uri.parse(“sms:”)); You can add extras to populate your own message and such like this sendIntent.putExtra(“sms_body”, x); then just startActivity with the intent. startActivity(sendIntent);

Show compose SMS view in Android

You can use the following code: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(“sms:” + phoneNumber))); Make sure you set phoneNumber to the phone number that you want to send the message to You can add a message to the SMS with (from comments): Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(“sms:” + phoneNumber)); intent.putExtra(“sms_body”, message); startActivity(intent);

Android – Listen For Incoming SMS Messages

public class SmsListener extends BroadcastReceiver{ private SharedPreferences preferences; @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub if(intent.getAction().equals(“android.provider.Telephony.SMS_RECEIVED”)){ Bundle bundle = intent.getExtras(); //—get the SMS message passed in— SmsMessage[] msgs = null; String msg_from; if (bundle != null){ //—retrieve the SMS message received— try{ Object[] pdus = (Object[]) bundle.get(“pdus”); msgs = … Read more

Android: Share plain text using intent (to all messaging apps)

Use the code as: /*Create an ACTION_SEND Intent*/ Intent intent = new Intent(android.content.Intent.ACTION_SEND); /*This will be the actual content you wish you share.*/ String shareBody = “Here is the share content body”; /*The type of the content is text, obviously.*/ intent.setType(“text/plain”); /*Applying information Subject and Body.*/ intent.putExtra(android.content.Intent.EXTRA_SUBJECT, getString(R.string.share_subject)); intent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody); /*Fire!*/ startActivity(Intent.createChooser(intent, getString(R.string.share_using)));

How can I read SMS messages from the device programmatically in Android?

Use Content Resolver (“content://sms/inbox”) to read SMS which are in inbox. // public static final String INBOX = “content://sms/inbox”; // public static final String SENT = “content://sms/sent”; // public static final String DRAFT = “content://sms/draft”; Cursor cursor = getContentResolver().query(Uri.parse(“content://sms/inbox”), null, null, null, null); if (cursor.moveToFirst()) { // must check the result to prevent exception do … Read more