Skip to content

Using ShareSheet and Intent Resolver in Android to share the data from one app to another

Notifications You must be signed in to change notification settings

veenaSinghits/SharingJetPackComponents

Repository files navigation

SharingJetPackComponent

Impleentation of ShareSheet and Intent Resolver in Android.

fun ClickedShareSheet(){ val intent = Intent().apply { action = Intent.ACTION_SEND putExtra(Intent.EXTRA_TEXT, editTextMessage.getText().toString()) type = "text/plain" } val pi = PendingIntent.getBroadcast( applicationContext, 100, Intent(applicationContext, MyBroadcastReceiver::class.java), PendingIntent.FLAG_UPDATE_CURRENT ) val share = Intent.createChooser(intent, null, pi.intentSender) startActivity(share) } // This function is use for share content by using ShareSheet.

fun ClickedbyIntentResolver(){
    val sendIntent: Intent = Intent().apply {
        action = Intent.ACTION_SEND
        putExtra(Intent.EXTRA_TEXT, editTextMessage.getText().toString())
        type = "text/plain"
    }
    startActivity(sendIntent)
}// This function is use for share content by using Intent Resolver(No need of createChooser).

MainActivity.kt class is used for sharing the content.

Receiver.kt is used for receiving the content.

About

Using ShareSheet and Intent Resolver in Android to share the data from one app to another

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages