{ "id": "162709", "key": "TIMOB-23795", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2016-08-19T18:49:25.000+0000", "priority": null, "labels": [ "android", "camera", "engTriage", "hyperloop" ], "versions": [], "issuelinks": [], "assignee": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2019-11-19T15:52:46.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "13715", "name": "Hyperloop", "description": "Hyperloop project" } ], "description": "Trying to use the Android Camera2 API CameraManager fails with this error message:\r\n\r\n{{Message: Uncaught TypeError: Object android.hardware.camera2.CameraManager@436cda3 has no method 'getCameraIdList'}}\r\n\r\n*Code:*\r\n\r\n{code:java}\r\nvar Activity = require('android.app.Activity');\r\nvar Context = require(\"android.content.Context\");\r\nvar activity = new Activity(Titanium.App.Android.getTopActivity());\r\nvar CameraManager = require(\"android.hardware.camera2.CameraManager\");\r\n\r\nvar cameraManager = activity.getSystemService(CameraManager.class);\r\nconsole.log(\"CameraManager: \" + cameraManager);\r\n\r\nif (cameraManager !== null) {\r\n var cameraIdList = cameraManager.getCameraIdList();\r\n console.log(\"CameraIDs: \" + JSON.stringify(cameraIdList));\r\n}\r\n\r\nvar cameraManager = activity.getSystemService(Context.CAMERA_SERVICE);\r\nconsole.log(\"CameraManager: \" + cameraManager);\r\n\r\nif (cameraManager !== null) {\r\n var cameraIdList = cameraManager.getCameraIdList();\r\n console.log(\"CameraIDs: \" + JSON.stringify(cameraIdList));\r\n}\r\n{code}\r\n\r\nAndroid 6.0.1\r\nTitanium 5.4.0", "attachment": [], "flagged": false, "summary": "Hyperloop - Android: Using Camera2 API CameraManager not working", "creator": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "393704", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Moving to TIMOB. Does it work to supply the class as a String (e.g. {{\"CameraManager\"}} instead of {{CameraManager.class}})? That's at least how it's done on iOS. Otherwise it's a use-case we didn't cover, yet.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-08-20T22:42:31.000+0000", "updated": "2016-08-20T22:42:31.000+0000" }, { "id": "393712", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "I'll the string version. The fingerprint android example\nhttps://github.com/appcelerator/hyperloop-examples/blob/master/app/controllers/android/touchid.js\nuses the .class syntax so I've adopted that", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-08-21T07:58:56.000+0000", "updated": "2016-08-21T07:58:56.000+0000" }, { "id": "397166", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~michael] I think the following is the correct call:\r\n{code:javascript}\r\nactivity.getSystemService(Context.CAMERA_SERVICE);\r\n{code}\r\nbut it might not be called because the previous call returns something non-null that is still not able to handle {{getCameraIdList}}. So can you try to just call the second option? I'm just wondering why this specific class would not work, but others do. Thanks!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-09-24T19:37:01.000+0000", "updated": "2016-09-24T19:37:01.000+0000" }, { "id": "397170", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "Just using this:\r\n\r\n{code:java}\r\nvar cameraManager = activity.getSystemService(Context.CAMERA_SERVICE);\r\nconsole.log(\"CameraManager: \" + cameraManager);\r\n\r\nif (cameraManager !== null) {\r\n var cameraIdList = cameraManager.getCameraIdList();\r\n console.log(\"CameraIDs: \" + JSON.stringify(cameraIdList));\r\n}\r\n{code}\r\n\r\nwill still show:\r\n\r\n\r\n{noformat}\r\n[INFO] CameraManager: android.hardware.camera2.CameraManager@2f69c118\r\n[ERROR] TiExceptionHandler: (main) [1341,1341] ----- Titanium Javascript Runtime Error -----\r\n[ERROR] TiExceptionHandler: (main) [0,1341] - In alloy/controllers/index.js:44,42\r\n[ERROR] TiExceptionHandler: (main) [0,1341] - Message: Uncaught TypeError: Object android.hardware.camera2.CameraManager@2f69c118 has no method 'getCameraIdList'\r\n[ERROR] TiExceptionHandler: (main) [1,1342] - Source: var cameraIdList = cameraManager.getCameraIdList();\r\n[ERROR] V8Exception: Exception occurred at alloy/controllers/index.js:44: Uncaught TypeError: Object android.hardware.camera2.CameraManager@2f69c118 has no method 'getCameraIdList'\r\n{noformat}\r\n\r\nA side note:\r\nI was using hyperloop 1.2.0 before and just found out, that it skipped the update to 1.2.7 everytime. When I removed the old 1.2.0 folder and run appc new again it successfully downloaded 1.2.7. But the error above is still with the latest version!", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-09-24T20:56:10.000+0000", "updated": "2016-09-24T20:56:10.000+0000" }, { "id": "419449", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "Still the same with Hyperloop 2.1.0", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-05-10T09:21:49.000+0000", "updated": "2017-05-10T09:21:49.000+0000" }, { "id": "452409", "author": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "body": "Hi @Michael, did you have success using Hyperloop with Camera2 API? We are looking for going this way since we need better compression on newer Android models (that capture 4k by default).", "updateAuthor": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "created": "2019-10-31T21:16:36.000+0000", "updated": "2019-10-31T21:16:36.000+0000" }, { "id": "452410", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~ygbr] no, not yet. Same error with Hyperloop 4.0.4.\r\nIt might work fine creating a normal module. For me it was just a test so I didn't bother", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-10-31T21:32:08.000+0000", "updated": "2019-10-31T21:32:08.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }