private static Intent createShareIntentInternal(@NonNull final Context context, @NonNull final String mimeType, @Nullable final String subject, @Nullable final String body, @Nullable final Uri uri, @Nullable final String receiver) {

        final Intent intent = new Intent(Intent.ACTION_SEND);
        intent.setType(mimeType);
        if (StringUtils.isNotBlank(subject)) {
            intent.putExtra(Intent.EXTRA_SUBJECT, subject);
        }
        if (StringUtils.isNotBlank(body)) {
            intent.putExtra(Intent.EXTRA_TEXT, body);
        }
        if (StringUtils.isNotBlank(receiver)) {
            intent.putExtra(Intent.EXTRA_EMAIL, new String[]{receiver});
        }
        if (null != uri) {
            Uri uriToUse = uri;
            final File uriFile = UriUtils.toFile(uri);
            if (uriFile != null) {
                uriToUse = fileToUri(context, uriFile);
            }

            // Grant temporary read permission to the content URI.
            intent.putExtra(Intent.EXTRA_STREAM, uriToUse);
            intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        }
        return intent;
    }
context needs to be filled only when file is not null
main/src/main/java/cgeo/geocaching/utils/ShareUtils.java