Last active
May 25, 2020 18:32
-
-
Save Arrowsome/48cb72b09b20b50e42e9c03c991c0681 to your computer and use it in GitHub Desktop.
[Intent | Intent Filter] Send intent to specific application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val intent = Intent().apply { | |
action = Intent.ACTION_SEND | |
type = "text/plain" | |
putExtra(Intent.EXTRA_TEXT, "Hello, Kotlin!") | |
setPackage("com.whatsapp") | |
} | |
val isWhatsappAvailable = intent.resolveActivity(packageManager) | |
isWhatsappAvailable?.let { | |
startActivity(intent) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment