Created
June 5, 2020 03:27
-
-
Save jtmuller5/bcb4697201f6a6a06697e8892967588a to your computer and use it in GitHub Desktop.
Handle Intent from Custom Tab
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
// Handle any possible intents ************************************************************************** | |
// The URL is stored in the intent's data | |
val data: Uri? = intent?.data | |
// Figure out what to do based on the intent type | |
if (intent?.type?.startsWith("image/") == true) { | |
// Handle intents with image data ... | |
Log.d("Intent",intent?.type.toString()) | |
} else if (intent?.type == "text/plain") { | |
// Handle intents with text ... | |
Log.d("Intent.text",intent.extras?.getString("android.intent.extra.TEXT").toString()) | |
}else{ | |
if (data != null) { | |
Log.d("Intent URL",data.toString()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment