I have a requirement in my application in which I have to send MMS on click of button. When I click on the button it prompts to choose using which application I want to complete the action either email or messaging. I want it to open by default with messaging. I searched a lot but couldn't get any answer. Below, I am posting my code:
public class MMSActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button mms = (Button)findViewById(R.id.mms);
mms.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
sendMMS();
}
});
}
public void sendMMS() {
Intent in = new Intent(Intent.ACTION_SEND);
in.putExtra("sms_body", "some text");
in.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(Environment.getExternalStorageDirectory()
.getAbsolutePath().toString()+"/diplomat/ALEXANDRA-1339242345022.jpg")));
in.setType("image/jpeg");
startActivity(in);
Log.d("MMS", "SendMMS called");
}
}
I even tried with setting class as android.telephony.SmsMessage but it didn't worked.