{ "id": "137542", "key": "TIMOB-17812", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "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": [ { "id": "16593", "description": "Release 4.0.0", "name": "Release 4.0.0", "archived": false, "released": true, "releaseDate": "2015-05-21" }, { "id": "16723", "description": "Windows Platform Support, ListView updates, Vector overlays in maps", "name": "Release 4.1.0", "archived": false, "released": true, "releaseDate": "2015-07-08" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-04-30T15:12:54.000+0000", "created": "2014-10-01T15:36:23.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "camera", "ios8", "media" ], "versions": [], "issuelinks": [], "assignee": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2015-06-29T17:44:32.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "h6.Feature Request\r\nWhen building with the 3.4.0.GA TiSDK using the iOS 8 SDK on an iPhone 6 this issue is present. The issue is not that the prompt never shows but that its only triggered by launching the camera. If I want to prompt the user before I launch the camera there is no way to prompt the user. \r\n\r\nWe would like to request the following features for Titanium 3.5.0 SDK: \r\n1. Calling isCameraSupported() triggers the camera allowed prompt \r\n2. If the user says Don't Allow calling isCameraSupported() again should return false, but its returning true which is incorrect. \r\n\r\nh6.Steps to reproduce\r\n# Build attached sample with environment specification\r\n# On the device go to settings > general > scroll to bottom, reset > reset Location & privacy \r\n# Launch the app and,\r\n# Click \"is Camera supported\" button \r\n# Notice that it returns 1 which is true \r\n# Click Launch Camera (Notice that a prompt is shown asking for access to the camera. \r\n# Click Dont allow \r\n# Take a picture and accept it \r\n# Notice that the picture is black \r\n# Accept the picture \r\n# Click is Camera Supported \r\n# Notice that it returns 1 which is true. \r\n\r\nh6.Notes\r\nThe user did not allow camera access so the isCameraSupported should return false. Also the prompt to enable camera access should be triggered by the isCameraSupported call or some other call so that we can ask the user if they want to allow camera access before we launch the camera. \r\n\r\nFollowing my steps on step 4 isCameraSupported() returns a 1 that it is supported, and no prompt is shown. \r\n\r\nThen if you go to step 6 and launch image capture the prompt shows up but at that point the camera is being launched. We need to be able to trigger the prompt on the isCameraSupported call. \r\n\r\nNow in step 7 click the Dont Allow button and take a picture of the black area, notice its black. Now accept or close the image capture viewfinder. Click as stated in step 11 isCameraSupported(). Notice that its still a 1 which indicates that the camera is supported even though the user has not allowed access. \r\n\r\n", "attachment": [ { "id": "51755", "filename": "3.4_Camera_Access_Prompt.zip", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-10-01T15:36:23.000+0000", "size": 4869321, "mimeType": "application/zip" } ], "flagged": false, "summary": "iOS: Feature Request to initiate the camera access prompt via Titanium Code", "creator": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "environment": "iOS 8 \r\nXcode 6\r\nTi SDK 3.4.0.GA\r\n", "closedSprints": [ { "id": 398, "state": "closed", "name": "2015 Sprint 09 SDK", "startDate": "2015-04-25T00:00:00.000Z", "endDate": "2015-05-09T00:00:00.000Z", "completeDate": "2015-05-11T14:11:17.028Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "351193", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Another PR option here: https://github.com/appcelerator/titanium_mobile/pull/6811 \r\n4_0_X: https://github.com/appcelerator/titanium_mobile/pull/6812\r\nh4. Sample Code\r\n{code}\r\nvar win1 = Titanium.UI.createWindow({\r\n\tbackgroundColor: 'white'\r\n});\r\n\r\nvar button1 = Titanium.UI.createButton({\r\n\ttitle: 'is camera supported',\r\n\ttop: \"20%\"\r\n});\r\n\r\nvar button2 = Titanium.UI.createButton({\r\n\ttitle: 'is camera authorized',\r\n\ttop: \"40%\"\r\n});\r\nvar button3 = Titanium.UI.createButton({\r\n\ttitle: 'request camera access',\r\n\ttop: \"60%\"\r\n});\r\n\r\nvar button4 = Titanium.UI.createButton({\r\n\ttitle: 'open camera',\r\n\ttop: \"80%\"\r\n});\r\n\r\nbutton1.addEventListener('click', function(e) {\r\n var isCameraSupported = Ti.Media.isCameraSupported;\r\n var alert = Ti.UI.createAlertDialog({\r\n title: 'Is Camera Supported?',\r\n message: isCameraSupported\r\n });\r\n alert.show(); \r\n});\r\n\r\nbutton2.addEventListener('click', function(e) {\r\n\tif (Ti.Platform.name == \"iPhone OS\" && parseInt(Ti.Platform.version.split(\".\")[0]) >= 8) {\r\n\t var cameraAuthorizationStatus = Ti.Media.cameraAuthorizationStatus;\r\n\t var theMsg;\r\n\t if (cameraAuthorizationStatus === Ti.Media.CAMERA_AUTHORIZATION_AUTHORIZED) {\r\n\t \ttheMsg = 'approved';\r\n\t };\r\n\t if (cameraAuthorizationStatus === Ti.Media.CAMERA_AUTHORIZATION_DENIED) {\r\n\t //at one point of time the user denied camera access\r\n\t \ttheMsg = 'Camera access was denied, please go to phone settings to give access';\r\n\t };\r\n\t if (cameraAuthorizationStatus === Ti.Media.CAMERA_AUTHORIZATION_RESTRICTED) {\r\n\t \ttheMsg = 'restricted';\r\n\t };\r\n\t if (cameraAuthorizationStatus === Ti.Media.CAMERA_AUTHORIZATION_NOT_DETERMINED) {\r\n\t \ttheMsg = 'not determined';\r\n\t \t//althernatively, you can immediately call requestCameraAccess here\r\n\t };\r\n\t var alert = Ti.UI.createAlertDialog({\r\n\t title: 'Camera Authorization Status',\r\n\t message: theMsg\r\n\t });\r\n\t alert.show(); \r\n\t}\r\n\telse {\r\n\t\tvar alert = Ti.UI.createAlertDialog({\r\n\t title: 'IOS 7 or greater',\r\n\t message: 'only available for ios 7 and greater'\r\n\t });\r\n\t alert.show();\r\n\t}\r\n});\r\n\r\nbutton3.addEventListener('click', function(e) {\r\n\tif (Ti.Platform.name == \"iPhone OS\" && parseInt(Ti.Platform.version.split(\".\")[0]) >= 8) {\r\n\t\tTi.Media.requestCameraAccess(function(e) {\r\n\t\t\tvar theMsg;\r\n\t\t\tif (e.success) {\r\n\t\t\t\ttheMsg = 'User granted access';\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\ttheMsg = 'User denied access';\r\n\t\t\t}\r\n\r\n\t\t var alert = Ti.UI.createAlertDialog({\r\n\t\t title: 'Camera request access',\r\n\t\t message: theMsg\r\n\t\t });\r\n\t\t alert.show(); \r\n\t\t});\r\n\t}\r\n\telse {\r\n\t\tvar alert = Ti.UI.createAlertDialog({\r\n\t title: 'IOS 7 or greater',\r\n\t message: 'only available for ios 7 and greater'\r\n\t });\r\n\t alert.show();\r\n\t}\r\n\r\n});\r\nbutton4.addEventListener('click', function(e) {\r\n\tTi.Media.showCamera();\r\n});\r\n\r\nwin1.add(button1);\r\nwin1.add(button2);\r\nwin1.add(button3);\r\nwin1.add(button4);\r\n\r\nwin1.open();\r\n{code}\r\n", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-04-29T23:14:20.000+0000", "updated": "2015-04-29T23:22:48.000+0000" }, { "id": "356256", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed, using:\r\n\r\nMacOS 10.11\r\nStudio 4.1.0.201506261427\r\nTi SDK 4.1.0.v20150626084425\r\nAppc NPM 4.1.0-1\r\nAppc CLI 4.1.0-4\r\nTi CLI 4.0.1\r\nAlloy 1.6.2\r\nNode v0.10.37\r\nJava 1.7.0_45\r\n\r\nPrompts for camera access via code is working as expected.", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-06-29T17:44:32.000+0000", "updated": "2015-06-29T17:44:32.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }