Android camera permission denial error on Kitkat with intent provider

I implemented a flow in an Android app in which user clicks a picture with his/her mobile camera. The app then show the clicked picture for cropping.

I wanted not to store the clicked picture in internal app cache directory and not to store in external flash drive, as I don’t want to ask for external storage permission. I did this using FileProvider from Android v4 support lib with following code :

All was working perfectly fine. Then I start seeing of app crash specific to Android Kitkat. Exception :

Searched in Google and found the solution here.

Solution is to give permission when starting the camera app

Revoke the permission in onActivityResult

 

 

 

RxAndroid and exception handling

I am using RxAndroid to implement a flow like this.

Upload the image -> Get httpurl of uploaded image -> call rest api with image url and description to publish a Shot.

Where uploadImage using Retrofit Observable.

This code is not handling exception if the image upload fails. Suddenly I started getting lot to app crashes with following exception.

To fix this i have to handle exception when one the image upload service fails to upload the image.

 

And the problem is solved.