Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launch default SMS app without a message

I am wanting my app to, on a button click, launch the user's default texting app. The intention is not to have the user send a message, but to view their current text conversations, therefore I don't want it to launch the SMS app's "New Message" activity but instead the main app's activity itself.

If I do the following:

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

Then this is launched, instead I want it to launch the main part of the app, not this new message screen:

enter image description here

like image 510
AggieDev Avatar asked May 27 '15 01:05

AggieDev


People also ask

How do I open my default SMS app?

Navigate to and open Settings, and then tap Apps. Tap Choose default apps, and then tap SMS app.

What is the meaning of default SMS app?

Since the introduction of Android 4.4, Google allows only one app to run as default SMS app. Only your selected app is authorized to manage the SMS database entirely. The concept of one single default SMS app was introduced by Google and represents a change of the operating system that we are not able to influence.

How do I turn off default messages?

Open the Messages app . Settings. Turn off All "Default settings" notifications.


2 Answers

  String defaultApplication = Settings.Secure.getString(getContentResolver(), "sms_default_application");
        PackageManager pm = getPackageManager();
        Intent intent = pm.getLaunchIntentForPackage(defaultApplication );
        if (intent != null) {
            startActivity(intent);
        }
like image 184
Dhinakaran Thennarasu Avatar answered Oct 14 '22 19:10

Dhinakaran Thennarasu


    Intent intent = new Intent(Intent.ACTION_MAIN);

    intent.addCategory(Intent.CATEGORY_DEFAULT);

    intent.setType("vnd.android-dir/mms-sms");

    startActivity(intent);

This may be what you want.

like image 7
NeilYoung Avatar answered Oct 14 '22 18:10

NeilYoung