What you are looking for cannot be done using implicit
Intents. Because that is how the Android system is designed to handle implicit intents. If you want your intent to be handled by a specific application then you have to make them explicit
, i.e., specify a component that has to handle the intent. But when you use explicit
intents to handle any situation such as yours, then there is a great chance of your app to break when the specific component (i.e. Application) doesn't not exist in the target device. Android is being adopted by several OEMs, therefore each of them tend to replace the stock Messaging application with their own. So what seems to work on one device may not work on the other.
If you want to achieve what you want then you may have to get the list of Messaging applications on various devices, (you can find the stock Android app's component name from the emulator itself). And use the PackageManager
to find if the component exists. If it does, the start and explicit
intent, in which you won't receive an IntentChooser
. If the component doesn't exist send an implicit
intent.
You can learn more about intents from here.
Determining if an Activity exists on the current device? - This post will help you to find if the target component exists.