Skip to content

Instantly share code, notes, and snippets.

@showsky
Created January 7, 2017 17:17
Show Gist options
  • Select an option

  • Save showsky/d6e0911ffcb6c03915b463daa749e256 to your computer and use it in GitHub Desktop.

Select an option

Save showsky/d6e0911ffcb6c03915b463daa749e256 to your computer and use it in GitHub Desktop.
Android FileProvider
....
String realFileUri = new File(AppHelper.getDirectoryPath(), AppHelper.getFileName() + ".jpeg");
mMediaUri = FileProvider.getUriForFile(
getContext(),
"com.nnnnnnn.provider",
realFileUri
);
Log.e("=====>", "Share URI: " + mMediaUri.toString());
Log.e("=====>", "Real File URI: " + realFileUri.toStrig());
Intent iCamera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
iCamera.putExtra(MediaStore.EXTRA_OUTPUT, mMediaUri);
startActivityForResult(iCamera, Constants.INTENT_CALL.CAPTURE_IMAGE);
switch (requestCode) {
case Constants.INTENT_CALL.CAPTURE_IMAGE:
String filePath = SiliCompressor.with(getActivity()).compress(realFileUri.toString(), true);
}
....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment