Search code examples
androidgmailsizeadditionemail-attachments

Adding a file as an attachment to gmail


When I add file as attachment to gmail, i dont see my files, only message "one of the file has size more than 20mb", but i checked and i have to files json and image, json has size small than 1kb and image has size small than 600kB.

I checked and i havent opportunity to compress more files and dont see reason why i need to do this.

Intent sharingIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
        sharingIntent.setType("vnd.android.cursor.dir/email");

        Uri jsonPath = Uri.fromFile(json);
        Uri screenshotPath = Uri.fromFile(image);
        ArrayList<Uri> uris = new ArrayList<>();
        uris.add(json);
        uris.add(image);
        StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
        StrictMode.setVmPolicy(builder.build());
        sharingIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
        sharingIntent.putExtra(Intent.EXTRA_SUBJECT, "Please entry the subject");
        sharingIntent.putExtra(Intent.EXTRA_TEXT, "Please entry the content of email");
        startActivity(Intent.createChooser(sharingIntent, "Choose direct application"));

I would like to include these files :)


Solution

  • Ok, i have answear.

    fileIn.setReadable(true, false)