Don't want option to be given for sending mms`

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.

Answers


I want it to open by default with messaging

First, it is unclear what you think "messaging" is. I will assume that you mean the Android open source project (AOSP) MMS client.

Second, many devices do not have this app. Device manufacturers are welcome to use whatever MMS client they wish, which may or may not be the AOSP client.

Third, users are welcome to install and use their own SMS/MMS clients that they obtain from the Play Store or elsewhere. By saying that users should not have a choice in the matter, you are saying that you are more important than your users. Your users will tend to disagree.

Please allow your users to use whatever MMS client they wish, and at least one that actually exists.


If you are sending image.

Intent sendIntent = new Intent(Intent.ACTION_SEND); 
        sendIntent.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");
        sendIntent.putExtra("sms_body", "some text"); 
        sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/image_4.png"));
        sendIntent.setType("image/png");
        startActivity(sendIntent);; 

Need Your Help

regex for email validation: where is the error?

php regex email email-validation

This sounds strange, but I've been using this function for quite a while now and "suddenly, from one day to the other" it does not filter some addresses in the right way anymore. However, I cannot...

ImportError: cannot import name widgets from django.contrib.admin

python django django-admin newrelic

I'm getting the following inexplicable error all of a sudden: