Android — intent chooser for whatsapp and sms only


I want to create an IntentChooser who offer to share text only via SMS or WhatsApp.

Here is my code to share via WhatsApp:

Intent localIntent = new Intent(Intent.ACTION_SEND); localIntent.setType("text/plain"); localIntent.setPackage("com.whatsapp"); if (localIntent != null) { localIntent.putExtra(Intent.EXTRA_TEXT, "Hi there! I'm using this app"); startActivity(Intent.createChooser(localIntent, "Hi there! I'm using this app"); }

I need to add to this also sharing with SMS. How can I do it?

Thank on advance.


use this for <strong>Whatsapp</strong>.

try { startActivity(new Intent(Intent.ACTION_SEND).setType("text/plain").setPackage("com.whatsapp").putExtra(Intent.EXTRA_TEXT, Message)); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(this, "Whatsapp have not been installed.", Toast.LENGTH_SHORT).show(); }

and this for <strong>SMS</strong> .

String number = "12346556"; // The number on which you want to send SMS startActivity(new Intent(Intent.ACTION_VIEW, Uri.fromParts("sms", number, null)));


<strong>Possibly Duplicate</strong> of <a href="https://stackoverflow.com/questions/9730243/how-to-filter-specific-apps-for-action-send-intent-and-set-a-different-text-for/18068122#18068122" rel="nofollow">Multiple IntentChooser</a>


  • How to share .gif file with in other App using intent? [closed]
  • Open vimeo application via URL
  • What is the identity field value generated in WhatsApp Android/iOS clients?
  • Showing in-call status bar (double height) for a custom VoIP app in iOS
  • accessing file on sdcard android
  • How to make an implicit intent explicit?
  • Android: Using email intent to send email, possible to alter message just before sending?
  • CropActivity is not starting in onActivityResult inside Fragment
  • iphone page curl without uiviewanimation
  • How to position UITableViewCell to the bottom of TableView?
  • How to get a callback from google maps in Android application, when navigation is complete
  • Going back and forth between intents without losing user entered data
  • Facebook Messenger not showing up with UIActivityViewController
  • Home screen shortcut to activity
  • Sharing image from android app
  • How to detect airplane mode especially in jelly beam?
  • WebView memory leak
  • Can i detect if a user canceled navigation from Google Maps App
  • Passing and ArrayList through intent
  • How can I send mail from my app with underline or bold text?
  • FCM Data messages are not working properly
  • How to move again MainActivity after sending the mail?
  • Sending email using standard gmail app without chooser
  • Send data from edittext to listview
  • How can I let users share their location in Bot Framework webchat channel?
  • Splash Screen will not display
  • How can go in last activity with resume button?
  • HttpURLConnection Closing IO Streams
  • How to 'create temp table as select' in Slick?
  • Android Google Maps API v2 start navigation
  • Parsing a CSV string while ignoring commas inside the individual columns
  • Dialing with Intent.ACTION_CALL stopps at # in phone number
  • Linker errors when using intrinsic function via function pointer
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Angular 2 constructor injection vs direct access
  • Java static initializers and reflection
  • Android Google Maps API OnLocationChanged only called once
  • LevelDB C iterator
  • How can i traverse a binary tree from right to left in java?
  • UserPrincipal.Current returns apppool on IIS