You have two options.
Register the app as a FileProvider
You have a complete and updated example in the Android documentation: https://developer.android.com/reference/android/support/v4/content/FileProvider.html
If you want to provide access to any 3rd party app, you can use this workaround:
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
(...)
List<ResolveInfo> resInfoList = context.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
for (ResolveInfo resolveInfo : resInfoList) {
String packageName = resolveInfo.activityInfo.packageName;
context.grantUriPermission(packageName, uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
}
Save the files in the mass storage unit (sdcard)
For example:
File sdCard = Environment.getExternalStorageDirectory();
File dir = new File (sdCard.getAbsolutePath() + "/newDir");
dir.mkdirs();
File file = new File(dir, "filename");
FileOutputStream f = new FileOutputStream(file);
...
Which one to choose
It depends on your goal.
If you want the user to have access to the files via usb, to make them available even after your app has been uninstalled, to not have the "used space" count of those files added to you app,... The "mass storage unit way" is the way to go.
If you want those files to be "tied" to your app, only available while your app is installed, only accesible via you app,... the "FileProvider way" is the way to go.
In Android, "mass storage unit way" seems preferible if it is not sensible data. Android people don't like "chains"/restrictions.