{ "id": "151650", "key": "TIMOB-19654", "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": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2015-10-08T02:40:32.000+0000", "created": "2015-10-01T05:12:28.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [], "versions": [ { "id": "14826", "description": "Release 5.1.0-remaining iOS9 features, Android M features", "name": "Release 5.1.0", "archived": false, "released": true, "releaseDate": "2015-11-20" } ], "issuelinks": [ { "id": "49250", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "outwardIssue": { "id": "150517", "key": "TIMOB-19375", "fields": { "summary": "Android: Android M new runtime permissions model", "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" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "5", "description": "The sub-task of the issue", "name": "Sub-task", "subtask": true } } } }, { "id": "49165", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "150791", "key": "TIMOB-19422", "fields": { "summary": "Android M: App crashes if using camera in device due to permissions", "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" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "ssombhatla", "key": "ssombhatla", "displayName": "Srikanth Sombhatla", "active": false, "timeZone": "Asia/Singapore" }, "updated": "2017-03-21T23:01:07.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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "Running code: \r\n{code}\r\nTitanium.Media.showCamera({\r\n\tsuccess:function(event) {\r\n\t\t// called when media returned from the camera\r\n\t\tTi.API.debug('Our type was: '+event.mediaType);\r\n\t\tif(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {\r\n\t\t\tvar imageView = Ti.UI.createImageView({\r\n\t\t\t\twidth:win.width,\r\n\t\t\t\theight:win.height,\r\n\t\t\t\timage:event.media\r\n\t\t\t});\r\n\t\t\twin.add(imageView);\r\n\t\t} else {\r\n\t\t\talert(\"got the wrong type back =\"+event.mediaType);\r\n\t\t}\r\n\t},\r\n\tcancel:function() {\r\n\t\t// called when user cancels taking a picture\r\n\t},\r\n\terror:function(error) {\r\n\t\t// called when there's an error\r\n\t\tvar a = Titanium.UI.createAlertDialog({title:'Camera'});\r\n\t\ta.setMessage(JSON.stringify(error));\r\n\t\ta.show();\r\n\t},\r\n\tsaveToPhotoGallery:true\r\n});\r\n{code}\r\n\r\nGives rise to log error:\r\n{code}\r\n10-01 13:07:22.718: E/TiExceptionHandler(27510): (main) [51,51] ----- Titanium Javascript Runtime Error -----\r\n10-01 13:07:22.718: E/TiExceptionHandler(27510): (main) [0,51] - In app.js:1,16\r\n10-01 13:07:22.718: E/TiExceptionHandler(27510): (main) [1,52] - Message: Uncaught Error: android.app.Activity.checkSelfPermission\r\n10-01 13:07:22.718: E/TiExceptionHandler(27510): (main) [0,52] - Source: Titanium.Media.showCamera({\r\n{code}\r\n\r\nDue to https://github.com/appcelerator/titanium_mobile/blob/32600b01047b4654c92b341c6f0b61d38fa702b1/android/modules/media/src/java/ti/modules/titanium/media/MediaModule.java#L288\r\n\r\nhttp://developer.android.com/reference/android/content/Context.html#checkSelfPermission(java.lang.String) Being only available in API Level 23 and above.\r\n\r\nMore logs:\r\n{code}\r\n10-01 13:07:22.628: W/System.err(27510): java.lang.NoSuchMethodError: android.app.Activity.checkSelfPermission\r\n10-01 13:07:22.628: W/System.err(27510): \tat ti.modules.titanium.media.MediaModule.hasPermissions(MediaModule.java:288)\r\n10-01 13:07:22.628: W/System.err(27510): \tat ti.modules.titanium.media.MediaModule.showCamera(MediaModule.java:300)\r\n10-01 13:07:22.628: W/System.err(27510): \tat org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method)\r\n10-01 13:07:22.628: W/System.err(27510): \tat org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:177)\r\n10-01 13:07:22.628: W/System.err(27510): \tat org.appcelerator.kroll.KrollRuntime.handleMessage(KrollRuntime.java:299)\r\n10-01 13:07:22.628: W/System.err(27510): \tat org.appcelerator.kroll.runtime.v8.V8Runtime.handleMessage(V8Runtime.java:203)\r\n10-01 13:07:22.628: W/System.err(27510): \tat android.os.Handler.dispatchMessage(Handler.java:98)\r\n10-01 13:07:22.628: W/System.err(27510): \tat android.os.Looper.loop(Looper.java:136)\r\n10-01 13:07:22.628: W/System.err(27510): \tat org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)\r\n{code}", "attachment": [], "flagged": false, "summary": "Android: Error accessing Camera on device below M", "creator": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "subtasks": [], "reporter": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "environment": null, "closedSprints": [ { "id": 494, "state": "closed", "name": "2015 Sprint 20 SDK", "startDate": "2015-09-26T00:29:19.845Z", "endDate": "2015-10-10T00:29:00.000Z", "completeDate": "2015-10-12T05:33:30.964Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "365518", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Need to check if API 23 and above for this part https://github.com/appcelerator/titanium_mobile/blob/32600b01047b4654c92b341c6f0b61d38fa702b1/android/modules/media/src/java/ti/modules/titanium/media/MediaModule.java#L300", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-10-01T05:24:53.000+0000", "updated": "2015-10-01T05:24:53.000+0000" }, { "id": "365526", "author": { "name": "ssombhatla", "key": "ssombhatla", "displayName": "Srikanth Sombhatla", "active": false, "timeZone": "Asia/Singapore" }, "body": "Tested with this code. \r\n\r\n{code}\r\nTitanium.Media.showCamera({\r\n\tsuccess:function(event) {\r\n\t\t// called when media returned from the camera\r\n\t\tTi.API.debug('Our type was: '+event.mediaType);\r\n\t\tif(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {\r\n\t\t\tvar imageView = Ti.UI.createImageView({\r\n\t\t\t\twidth:win.width,\r\n\t\t\t\theight:win.height,\r\n\t\t\t\timage:event.media\r\n\t\t\t});\r\n\t\t\twin.add(imageView);\r\n\t\t} else {\r\n\t\t\talert(\"got the wrong type back =\"+event.mediaType);\r\n\t\t}\r\n\t},\r\n\tcancel:function() {\r\n\t\t// called when user cancels taking a picture\r\n\t},\r\n\terror:function(error) {\r\n\t\t// called when there's an error\r\n\t\tvar a = Titanium.UI.createAlertDialog({title:'Camera'});\r\n\t\ta.setMessage(JSON.stringify(error));\r\n\t\ta.show();\r\n\t},\r\n\tsaveToPhotoGallery:true\r\n});\r\n{code}\r\n\r\nPR https://github.com/appcelerator/titanium_mobile/pull/7258", "updateAuthor": { "name": "ssombhatla", "key": "ssombhatla", "displayName": "Srikanth Sombhatla", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-10-01T07:02:18.000+0000", "updated": "2015-10-01T07:02:18.000+0000" }, { "id": "366189", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-10-08T02:40:20.000+0000", "updated": "2015-10-08T02:40:20.000+0000" }, { "id": "366190", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Resolving this as duplicate.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-10-08T02:41:29.000+0000", "updated": "2015-10-08T02:41:29.000+0000" }, { "id": "414651", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as duplicate with reference to the above comments.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-21T23:01:07.000+0000", "updated": "2017-03-21T23:01:07.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }