0

I'm using ActivityResultAPI for capturing photos in my app so as I'm using this API I can't include CAMERA permission in Manifest file right.

But now in my application there is barcode scanner feature for that I need camera permission to be added into manifest file.

But it gives below exception while using take picture feature but works fine for barcode sacn feature..

java.lang.SecurityException: Permission Denial: starting Intent { act=android.media.action.IMAGE_CAPTURE flg=0x3 cmp=com.android.camera/.Camera clip={text/uri-list {...}} (has extras) } from ProcessRecord{67b91af 8305:com.ehr.myairmed/u0a422} (pid=8305, uid=10422) with revoked permission android.permission.CAMERA

Is there any alternative solution for this problem? Thanks.

  • Have you asked permissions programmatically? – Junaid Khalid Mar 16 '22 at 15:10
  • @JunaidKhalid yes, I've added CAMERA permission in Manifest file and also asked runtime permission using RequestPermission contract. That works fine for me, but if I used image capture feature first before requesting CAMERA permission then the app gets crashed giving above mentioned error. – ganpat malekar Mar 16 '22 at 15:16
  • Well that is the normal behavior. If the permissions are not given then the app will crash – Junaid Khalid Mar 16 '22 at 15:28
  • @JunaidKhalid no we don't require to add CAMERA permission for TakePicture() contract as per official document – ganpat malekar Mar 16 '22 at 15:32

0 Answers0