1
I am trying to send a ZIP file via Intent on Android with the code below:
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(out));
sendIntent.setType("application/zip");
startActivity(sendIntent);
But I can only send if it is via Whatsapp, other apps like Gmail, Outlook, Onedrive or Google Drive return errors like "could not attach/send the file".
I’ve modified Intent’s last line to:
startActivityForResult(sendIntent, ZIP_OK);
Where ZIP_OK = 101;
In:
@Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data)
The resultCode returns to 0 (zero) if not via Whatsapp.
Does anyone know what I haven’t done, or what I’m doing wrong?
It worked, thank you very much!!
– zampnrs