• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.
Hi Guys,

I'm getting the below Logcat error for Line 44in my Camera Activity -

01-03 18:17:42.106 30034-30034/com.example.nb.crunchnpeel E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.nb.crunchnpeel, PID: 30034
java.lang.SecurityException: Permission Denial: starting Intent { act=android.media.action.IMAGE_CAPTURE cmp=android/com.android.internal.app.ResolverActivity launchParam=MultiScreenLaunchParams { mDisplayId=0 mBaseDisplayId=0 mFlags=0 } } from ProcessRecord{6e4e108 30034:com.example.nb.crunchnpeel/u0a287} (pid=30034, uid=10287) with revoked permission android.permission.CAMERA
at android.os.Parcel.readException(Parcel.java:1693)
at android.os.Parcel.readException(Parcel.java:1646)
at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:3572)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1526)
at android.app.Activity.startActivityForResult(Activity.java:4403)
at android.support.v4.app.BaseFragmentActivityApi16.startActivityForResult(BaseFragmentActivityApi16.java:54)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:67)
at android.app.Activity.startActivityForResult(Activity.java:4362)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:732)
at com.example.nb.crunchnpeel.CameraActivity$btnTakePhotoClicker.onClick(CameraActivity.java:44)
at android.view.View.performClick(View.java:6261)
at android.widget.TextView.performClick(TextView.java:11180)
at android.view.View$PerformClick.run(View.java:23748)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)



The bit highlighted in red is line 44 for my CameraActivity -

class btnTakePhotoClicker implements Button.OnClickListener{

@override
public void onClick(View view) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent,CAM_REQUEST);
}
}
}

I do have
<uses-permission android:name="android.permission.CAMERA" />
in the Manifest?

Help is appreciated.

Nick
 
It's a permission issue. Have a look at this

https://stackoverflow.com/questions/32789027/android-m-camera-intent-permission-bug

and

https://developer.android.com/reference/android/provider/MediaStore.html#ACTION_IMAGE_CAPTURE

"Note: if you app targets M and above and declares as using the CAMERA permission which is not granted, then atempting to use this action will result in a SecurityException."

and

https://stackoverflow.com/questions/32789027/android-m-camera-intent-permission-bug

"If you are using Google M, go to Settings -> Apps -> your app -> and give the appropriate permissions."
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones