benbahrenburg / Ti.Light

Titanium Flashlight example module
Other
13 stars 11 forks source link

CameraBase: An error occurred while connecting to camera: 0 #10

Open ikruglik opened 8 years ago

ikruglik commented 8 years ago

Hello Ben,

I am encountering problems (app crash) using your latest module build on Android 6.x platform (no issues on 4.x-5.x though).

Google Nexus 5 6.0.0 API23

-- Start application log ----------------------------------------------------- [INFO] : TiApplication: (main) [0,0] checkpoint, app created. [INFO] : TiApplication: (main) [37,37] Titanium 5.2.1 (2016/03/18 22:51 23e1c7d) [INFO] : DatabaseHelper: No value in database for platform key: 'unique_machine_id' returning supplied default '' [INFO] : DatabaseHelper: No value in database for platform key: 'hardware_machine_id' returning supplied default '' [INFO] : TiApplication: (main) [5979,6016] Titanium Javascript runtime: v8 [WARN] : CameraBase: An error occurred while connecting to camera: 0 [WARN] : V8Object: (KrollRuntimeThread) [107,6123] Runtime disposed, cannot set property 'userAgent' [INFO] : Process: Sending signal. PID: 1844 SIG: 9 -- End application log -------------------------------------------------------

Could you please advice what might be the reason for that? Is it possible to fix the error somehow?

Thank you.

benbahrenburg commented 8 years ago

Looks like a permissions issue. Can you try asking for (and granting) the camera permission.

ikruglik commented 8 years ago

I assume the error is rising before I can request any permissions in my app, so I had to wrap camera = Camera.open() in onAppCreate function of your module in try-catch block.