use of android.support.v4.content.FileProvider in project MaxLock by Maxr1998.
the class MaxLockPreferenceFragment method onRequestPermissionsResult.
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
switch(requestCode) {
case BUG_REPORT_STORAGE_PERMISSION_REQUEST_CODE:
if (grantResults.length > 0 && grantResults[0] == PERMISSION_GRANTED) {
File zipFile = new File(getActivity().getCacheDir() + File.separator + "export", "report.zip");
// Move files and send email
final Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_EMAIL, new String[] { getString(R.string.dev_email) });
intent.putExtra(Intent.EXTRA_SUBJECT, "MaxLock feedback on " + Build.MODEL);
intent.putExtra(Intent.EXTRA_TEXT, "Please here describe your issue as DETAILED as possible!");
Uri uri = getUriForFile(getContext(), "de.Maxr1998.fileprovider", zipFile);
intent.putExtra(Intent.EXTRA_STREAM, uri);
new AlertDialog.Builder(getActivity()).setMessage(R.string.dialog_message_bugreport_finished_select_email).setPositiveButton(android.R.string.ok, (dialog, which) -> startActivity(Intent.createChooser(intent, getString(R.string.share_menu_title_send_email)))).create().show();
}
break;
}
}
Aggregations