@Nullable
    private static Uri fileToUri(@NonNull final Context context, @Nullable final File file) {
        if (file != null) {
            try {
                return FileProvider.getUriForFile(context, context.getString(R.string.file_provider_authority), file);
            } catch (Exception e) {
                Log.e("error converting file to uri:" + file, e);
            }
        }
        return null;
    }
Standard message box + additional share button for file sharing
main/src/main/java/cgeo/geocaching/utils/ShareUtils.java