0

I know that we can send SMS via built-in SMS app in this way -

Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.setData(Uri.parse("sms:"));  
sendIntent.putExtra("sms_body", "");
startActivity(sendIntent);

But in my app, I want to modify some text of the sms body before sending it to the receiver. Is there any way?

I know I can do it with sendTextMessage method of SmsManager. I just want to know, is it also possible with the built-in SMS app?

Thank you.

Khobaib
  • 1,577
  • 3
  • 21
  • 29

1 Answers1

0

This is not possible, since SmsManager is part of frameworks. You cannot hijack it.

Edit: What you could do is change your app manifest to recieve ACTION_VIEW and uri sms: just like default messaging app and then when launched will change the body and launch the default messaging app.

Edit: Add below intent filter to your app and then "sms_body" extra from the intent and rebroadcast it this time by createChooser

 <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <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" />
 </intent-filter>
nandeesh
  • 24,740
  • 6
  • 69
  • 79
  • how I can receive 'sms:' in the manifest? Also can you give me some detail how can I change the body upon launch? – Khobaib Aug 29 '12 at 23:37