1

I want to implement sharing functionality that allows the user to share a url via text message, facebook, email, etc. Is there a share sheet functionality in kotlin/android as there is in ios?How can I access that using kotlin code?

Chris Hansen
  • 7,813
  • 15
  • 81
  • 165

2 Answers2

3

Yes there is something called Android Sharesheet. You have examples on next link https://developer.android.com/training/sharing/send

sela
  • 314
  • 1
  • 11
2

This should be helpful for you:

val sharingIntent = Intent(Intent.ACTION_SEND)
sharingIntent.type = "text/plain"
val shareBody = "Text to be shared"
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject")
sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody)
context.startActivity(Intent.createChooser(sharingIntent, "Share using ..."))
Firzen
  • 1,909
  • 9
  • 28
  • 42