From this SO answer, I can set the Intent to a specific app by setPackage. For my scenario I need to share text to either WhatsApp, Instagram or Line. Is it possible to set more than one package bundle ID?
Using the Android intent resolver The Android intent resolver is best used when sending data to another app as part of a well-defined task flow. To use the Android intent resolver, create an intent and add extras as you would if you were to call the Android Sharesheet. However, do not call Intent. createChooser() .
The Intent is not deprecated the problem is with your itemClickable. class because it is not recognized.
Basically what it does is, it lets you set the type of data that you are using to send in an intent. You might also want to check out an existing question: Android - Intent.setType() arguments.
It isn't possible. What you can do is to call setPackage(String)
for one of them, send it and then rinse and repeat.
You may want to use PackageManager to see if the apps are installed, but from a security view point setPackage is not secure, because any app can use WhatsApp, Instagram,.. packages if they're not already installed. Assuming the intent is for a broadcast, maybe you should consider using an implicit intent as other apps may be interested?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With