{"action":"created","issue":{"url":"https://api.github.com/repos/dlazaro66/QRCodeReaderView/issues/129","repository_url":"https://api.github.com/repos/dlazaro66/QRCodeReaderView","labels_url":"https://api.github.com/repos/dlazaro66/QRCodeReaderView/issues/129/labels{/name}","comments_url":"https://api.github.com/repos/dlazaro66/QRCodeReaderView/issues/129/comments","events_url":"https://api.github.com/repos/dlazaro66/QRCodeReaderView/issues/129/events","html_url":"https://github.com/dlazaro66/QRCodeReaderView/issues/129","id":245960075,"number":129,"title":"'Fail to connect to camera service' when camera class initialize","user":{"login":"seojr","id":6961016,"avatar_url":"https://avatars3.githubusercontent.com/u/6961016?v=4","gravatar_id":"","url":"https://api.github.com/users/seojr","html_url":"https://github.com/seojr","followers_url":"https://api.github.com/users/seojr/followers","following_url":"https://api.github.com/users/seojr/following{/other_user}","gists_url":"https://api.github.com/users/seojr/gists{/gist_id}","starred_url":"https://api.github.com/users/seojr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seojr/subscriptions","organizations_url":"https://api.github.com/users/seojr/orgs","repos_url":"https://api.github.com/users/seojr/repos","events_url":"https://api.github.com/users/seojr/events{/privacy}","received_events_url":"https://api.github.com/users/seojr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-07-27T08:12:52Z","updated_at":"2017-08-29T04:09:06Z","closed_at":null,"body":"Hello, I faced RuntimeException .\r\nwhen i'm using like below.\r\n\r\n```java\r\nqrdeCoderView = new QRCodeReaderView(this);\r\n```\r\n\r\nFatal Exception: java.lang.RuntimeException: Fail to connect to camera service\r\n       at android.hardware.Camera.<init>(Camera.java:519)\r\n       at android.hardware.Camera.open(Camera.java:364)\r\n       at com.google.zxing.client.android.camera.open.OpenCameraInterface.open(OpenCameraInterface.java:76)\r\n       at com.google.zxing.client.android.camera.CameraManager.openDriver(CameraManager.java:104)\r\n       at com.dlazaro66.qrcodereaderview.QRCodeReaderView.surfaceCreated(QRCodeReaderView.java:213)\r\n       at android.view.SurfaceView.updateWindow(SurfaceView.java:656)\r\n       at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:172)\r\n       at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1013)\r\n       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2542)\r\n       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1537)\r\n       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7183)\r\n       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:959)\r\n       at android.view.Choreographer.doCallbacks(Choreographer.java:734)\r\n       at android.view.Choreographer.doFrame(Choreographer.java:670)\r\n       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:945)\r\n       at android.os.Handler.handleCallback(Handler.java:751)\r\n       at android.os.Handler.dispatchMessage(Handler.java:95)\r\n       at android.os.Looper.loop(Looper.java:154)\r\n       at android.app.ActivityThread.main(ActivityThread.java:6776)\r\n       at java.lang.reflect.Method.invoke(Method.java)\r\n       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)\r\n       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)\r\n\r\n\r\n\r\nI figure out mCameraManager.openDriver in QRCodeReaderView.surfaceCreated can throw RuntimeException. there are only catch the IOException without RuntimeException. so, need to add catch Exception or IOException.\r\n\r\n```java\r\ncatch (Exception e) {\r\n       Log.w(TAG, \"Can not openDriver: \" + e.getMessage());\r\n       mCameraManager.closeDriver();    \r\n}\r\n```\r\n\r\nor\r\n\r\n```java\r\ncatch (RuntimeException e) {\r\n       Log.w(TAG, \"Can not openDriver: \" + e.getMessage());\r\n       mCameraManager.closeDriver();    \r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/dlazaro66/QRCodeReaderView/issues/comments/325549807","html_url":"https://github.com/dlazaro66/QRCodeReaderView/issues/129#issuecomment-325549807","issue_url":"https://api.github.com/repos/dlazaro66/QRCodeReaderView/issues/129","id":325549807,"user":{"login":"darylsze","id":28452579,"avatar_url":"https://avatars0.githubusercontent.com/u/28452579?v=4","gravatar_id":"","url":"https://api.github.com/users/darylsze","html_url":"https://github.com/darylsze","followers_url":"https://api.github.com/users/darylsze/followers","following_url":"https://api.github.com/users/darylsze/following{/other_user}","gists_url":"https://api.github.com/users/darylsze/gists{/gist_id}","starred_url":"https://api.github.com/users/darylsze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darylsze/subscriptions","organizations_url":"https://api.github.com/users/darylsze/orgs","repos_url":"https://api.github.com/users/darylsze/repos","events_url":"https://api.github.com/users/darylsze/events{/privacy}","received_events_url":"https://api.github.com/users/darylsze/received_events","type":"User","site_admin":false},"created_at":"2017-08-29T04:09:06Z","updated_at":"2017-08-29T04:09:06Z","body":"may i know if author is going to fix this?"}}
{"actor":{"display_login":"darylsze"}}