Android Run time Exception -Failed to Connect Camera Service

  • Replies:0
  • OpenNot stickiedUnanswered
  • Forum posts: 1

Oct 17, 2016 9:39:01 AM via Website

I am using Camera for Barcode scanner App and On Some devices(LG G Flex, Asus Nexus 7) getting : Android Run time Exception -Failed to Connect Camera Service.
Here is the snippet from menifest file below :
uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"
uses-permission android:name="android.permission.CAMERA"

....
....

I am releasing camera on pause, stop and on destroy.
/**
* Restarts the camera.
*/
@Override
protected void onResume() {
super.onResume();
try {
startCameraSource();
} catch (Exception e) {
e.printStackTrace();

    }
}

/**
 * Stops the camera.
 */
@Override
protected void onPause() {
    super.onPause();
    if (mPreview != null) {
        mPreview.stop();
    }
}

/**
 * Releases the resources associated with the camera source, the associated detectors, and the
 * rest of the processing pipeline.
 */
@Override
protected void onDestroy() {
    super.onDestroy();
    if (mPreview != null) {
        mPreview.release();
    }

}

Still getting above runtime exception, and i do not have above two devices so that i can reproduce.
Is there any solution of that issue?