How can I make a share button in compose, which will share a download link,
I tried this but the result was different that I expected.
Here is the code.
Button(
onClick = {
val intent = Intent(Intent.ACTION_SEND)
.putExtra("File Download Link", downloadUrl.value)
.setType("text/plain")
context.startActivity(Intent.createChooser(intent, "Share Using"))
},
and this is how I am getting the downloadUrl value
val downloadUrl = remember { mutableStateOf("") }
val context = LocalContext.current
val launcher =
rememberLauncherForActivityResult(ActivityResultContracts.GetContent()) { uri ->
val task = firebaseUpload(uri, context)
task.addOnCompleteListener {
if (task.isSuccessful) {
downloadUrl.value = task.result.toString()
}
}
}
The downloadUrl value is right but when I copied it in the emulator it was copying the modifier.