I tried this but it only sends excel file not text I tried to send text and file in two intents and it works but in one intent no
val file = File(
Environment.getExternalStorageDirectory() ,
"newfolder/$name.xlsx"
val uri = FileProvider.getUriForFile(context , "com.example.android.fogara2" , file)
val sendIntent : Intent = Intent(Intent.ACTION_SEND).apply {
type="text/plain"
`package` = "com.whatsapp"
putExtra(Intent.EXTRA_TEXT,"sometext")
putExtra(Intent.EXTRA_STREAM , uri)
type = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
}
context.startActivity(sendIntent)