{ "id": "151244", "key": "AC-423", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2015-11-22T11:46:18.000+0000", "created": "2015-09-17T16:25:40.000+0000", "labels": [ "android", "camera" ], "versions": [], "issuelinks": [], "assignee": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "updated": "2015-11-22T13:34:46.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "\r\n{code:java}\r\nvar cameraOverlay = Titanium.UI.createView({});\r\nvar cameraOverlayButton = Titanium.UI.createView({\r\n bottom: 10,\r\n width: 100,\r\n height: 100,\r\n backgroundColor: \"#f00\"\r\n});\r\ncameraOverlay.add(cameraOverlayButton);\r\ncameraOverlayButton.addEventListener('click', function(e) {\r\n Ti.Media.takePicture();\r\n});\r\n\r\nfunction onOpen(argument) {\r\n\r\n Titanium.Media.showCamera({\r\n overlay: cameraOverlay,\r\n showControls: false,\r\n success: function(e) {\r\n Ti.API.info('# SUCCESS : ' + JSON.stringify(e));\r\n },\r\n cancel: function(e) {\r\n Ti.API.info('# CANCEL : ' + e.error);\r\n },\r\n error: function(e) {\r\n Ti.API.info('# ERROR : ' + e.code + ' : ' + e.error);\r\n },\r\n mediaTypes: Ti.Media.MEDIA_TYPE_PHOTO,\r\n });\r\n}\r\n\r\n$.index.addEventListener(\"open\", onOpen);\r\n$.index.open();\r\n{code}\r\n\r\nWhen using the latest SDK from the git (checkout 15th Sept.) and opening a camera with Ti.Media.showCamera() the app is crashing with\r\n\r\n{code}\r\nWARN] W/System.err: java.lang.NoSuchMethodError: No virtual method checkSelfPermission(Ljava/lang/String;)I in class Landroid/app/Activity; or its super classes (declaration of 'android.app.Activity' appears in /system/framework/framework.jar)\r\n[WARN] W/System.err: at ti.modules.titanium.media.MediaModule.hasPermissions(MediaModule.java:288)\r\n[WARN] W/System.err: at ti.modules.titanium.media.MediaModule.showCamera(MediaModule.java:300)\r\n[WARN] W/System.err: at org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method)\r\n[WARN] W/System.err: at org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:177)\r\n[WARN] W/System.err: at org.appcelerator.kroll.KrollRuntime.handleMessage(KrollRuntime.java:299)\r\n[WARN] W/System.err: at org.appcelerator.kroll.runtime.v8.V8Runtime.handleMessage(V8Runtime.java:203)\r\n[WARN] W/System.err: at android.os.Handler.dispatchMessage(Handler.java:98)\r\n[WARN] W/System.err: at android.os.Looper.loop(Looper.java:135)\r\n[WARN] W/System.err: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)\r\n[DEBUG] OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true\r\n[DEBUG] Atlas: Validating map...\r\n[ERROR] TiExceptionHandler: (main) [618,618] ----- Titanium Javascript Runtime Error -----\r\n[ERROR] TiExceptionHandler: (main) [1,619] - In alloy/controllers/index.js:42,20\r\n[ERROR] TiExceptionHandler: (main) [0,619] - Message: Uncaught Error: No virtual method checkSelfPermission(Ljava/lang/String;)I in class Landroid/app/Activity; or its super classes (declaration of 'android.app.Activity' appears in /system/framework/framework.jar)\r\n[ERROR] TiExceptionHandler: (main) [0,619] - Source: Titanium.Media.showCamera({\r\n[ERROR] V8Exception: Exception occurred at alloy/controllers/index.js:42: Uncaught Error: No virtual method checkSelfPermission(Ljava/lang/String;)I in class Landroid/app/Activity; or its super classes (declaration of 'android.app.Activity' appears in /system/framework/framework.jar)\r\n{code}\r\n\r\nOn my phone I'm running 5.1.1 not beta 6 (marshmallow) \r\n\r\n*Workaround*\r\nRemoving the checkSelfPermission() from hasPermissions() (MediaModule.java) will remove the error but probably won't be useful for Marshmallow.", "attachment": [], "flagged": false, "summary": "showCamera - checkSelfPermission will crash on Nexus 4 (Android 5.1.1)", "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": "Nexus 4\r\nAndroid 5.1.1\r\nTi SDK 5.1.0 (master branch - checkout 15.09.2015)\r\nTargeting Android SDK: 23", "comment": { "comments": [ { "id": "364461", "author": { "name": "pchowdhury", "key": "pchowdhury", "displayName": "Papia Chowdhury", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Hello,\r\n\r\nWe have tested this issue. Ti.Media.showCamera() works properly in my environment and app doesn't crash.\r\n\r\n*Testing Environment:*\r\nAppcelerator Studio, build: 4.3.0.201509031836\r\nAppcelerator Command-Line Interface, version 5.0.1\r\nTitanium SDK: 5.0.0GA\r\nAndroid Device: Nexus 7(android 5.1.1)\r\n\r\n*Steps to test*\r\n1.Create an alloy project\r\n2. Replace index.js with following code.\r\n3. Run the project\r\n4. When the app opens up, it will show the camera\r\n5. Click to capture image\r\n\r\nAnd observe that app didn't crash and output is shown on the console\r\n\r\n*Test Case*\r\nindex.js\r\n{code}\r\nvar cameraOverlay = Titanium.UI.createView({});\r\nvar cameraOverlayButton = Titanium.UI.createView({\r\n\tbottom : 10,\r\n\twidth : 100,\r\n\theight : 100,\r\n\tbackgroundColor : \"#f00\"\r\n});\r\ncameraOverlay.add(cameraOverlayButton);\r\ncameraOverlayButton.addEventListener('click', function(e) {\r\n\tTi.Media.takePicture();\r\n});\r\nfunction onOpen(argument) {\r\n\tTitanium.Media.showCamera({\r\n\t\toverlay : cameraOverlay,\r\n\t\tshowControls : false,\r\n\t\tsuccess : function(e) {\r\n\t\t\tTi.API.info('# SUCCESS : ' + JSON.stringify(e));\r\n\t\t},\r\n\t\tcancel : function(e) {\r\n\t\t\tTi.API.info('# CANCEL : ' + e.error);\r\n\t\t},\r\n\t\terror : function(e) {\r\n\t\t\tTi.API.info('# ERROR : ' + e.code + ' : ' + e.error);\r\n\t\t},\r\n\t\tmediaTypes : Ti.Media.MEDIA_TYPE_PHOTO,\r\n\t});\r\n}\r\n\r\n$.index.addEventListener(\"open\", onOpen);\r\n$.index.open(); \r\n{code}\r\n\r\n*Output:*\r\n{code}\r\n[INFO] : # SUCCESS : {\"y\":0,\"x\":0,\"height\":2592,\"width\":1944,\"media\":{\"file\":{\"hidden\":false,\"nativePath\":\"file:///data/data/com.gsl.\r\n{code}\r\n\r\nThanks.", "updateAuthor": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-09-21T09:42:35.000+0000", "updated": "2015-09-30T06:54:33.000+0000" }, { "id": "370336", "author": { "name": "jnaher", "key": "jnaher", "displayName": "Jebun Naher", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello,\r\n\r\nWe tested this issue but couldn't reproduce it as a bug in our environment. Ti.Media.showCamera() function is working as expected.\r\n\r\n*Console log:*\r\n{code}\r\n[INFO] : # SUCCESS : {\"y\":0,\"x\":0,\"height\":2592,\"width\":1944,\"media\":{\"file\":{\"hidden\":false,\"nativePath\":\"file:///data/data/com.gsl.newTest/app_appdata/tia1447669663928.jpg\",\"writable\":true,\"executable\":false,\"parent\":{\"hidden\":false,\"nativePath\":\"file:///data/data/com.gsl.newTest/app_appdata\",\"writable\":true,\"executable\":false,\"parent\":{\"hidden\":false,\"nativePath\":\"file:///data/data/com.gsl.newTest\",\"writable\":true,\"executable\":false,\"parent\":{\"hidden\":false,\"nativePath\":\"file:///data/data\",\"writable\":false,\"executable\":false,\"parent\":{\"hidden\":false,\"nativePath\":\"file:///data\",\"writable\":false,\"executable\":false,\"parent\":{\"hidden\":false,\"nativePath\":\"file:///\",\"writable\":false,\"executable\":false,\"parent\":null,\"readonly\":true,\"directoryListing\":[\"firmware\",\"persist\",\"sdcard\",\"storage\",\"config\",\"cache\",\"acct\",\"vendor\",\"d\",\"etc\",\"tombstones\",\"mnt\",\"ueventd.rc\",\"ueventd.flo.rc\",\"system\",\"sys\",\"service_contexts\",\"sepolicy\",\"selinux_version\",\"seapp_contexts\",\"sbin\",\"res\",\"property_contexts\",\"proc\",\"init.zygote32.rc\",\"init.usb.rc\",\"init.trace.rc\",\"init.rc\",\"init.flo.usb.rc\",\"init.flo.rc\",\"init.flo.diag.rc\",\"init.environ.rc\",\"init\",\"fstab.flo\",\"file_contexts\",\"default.prop\",\"data\",\"charger\",\"root\",\"dev\"],\"size\":0,\"apiName\":\"Ti.Proxy\",\"name\":\"\",\"symbolicLink\":false,\"bubbleParent\":true},\"readonly\":false,\"directoryListing\":[],\"size\":4096,\"apiName\":\"Ti.Proxy\",\"name\":\"data\",\"symbolicLink\":false,\"bubbleParent\":true},\"readonly\":false,\"directoryListing\":[],\"size\":8192,\"apiName\":\"Ti.Proxy\",\"name\":\"data\",\"symbolicLink\":false,\"bubbleParent\":true},\"readonly\":false,\"directoryListing\":[\"lib\",\"cache\",\"databases\",\"app_appdata\"],\"size\":4096,\"apiName\":\"Ti.Proxy\",\"name\":\"com.gsl.newTest\",\"symbolicLink\":false,\"bubbleParent\":true},\"readonly\":false,\"directoryListing\":[\"tia1447669663928.jpg\"],\"size\":4096,\"apiName\":\"Ti.Proxy\",\"name\":\"app_appdata\",\"symbolicLink\":false,\"bubbleParent\":true},\"readonly\":false,\"directoryListing\":[],\"size\":236024,\"apiName\":\"Ti.Proxy\",\"name\":\"tia1447669663928.jpg\",\"symbolicLink\":false,\"bubbleParent\":true},\"nativePath\":\"file:///data/data/com.gsl.newTest/app_appdata/tia1447669663928.jpg\",\"height\":2592,\"length\":236024,\"width\":1944,\"mimeType\":\"image/jpeg\",\"apiName\":\"Ti.Blob\",\"text\":null,\"type\":1,\"bubbleParent\":true},\"mediaType\":\"public.image\",\"code\":0,\"cropRect\":{\"height\":2592,\"width\":1944,\"y\":0,\"x\":0},\"success\":true}\r\n[INFO] : APSAnalyticsService: Stopping Analytics Service\r\n{code}\r\n\r\n*Testing Environment:*\r\nAppcelerator Studio, build: 4.3.3.201510212245\r\nAppcelerator Command-Line Interface, version 5.0.4\r\nMac Osx: 10.9.5\r\nTi sdk : 5.1.0.v20151113005238\r\nNode.js Version : 0.12.7\r\nJdk: 1.7.0_65\r\nDevice: Nexus7(Android 5.1.1)\r\n\r\n*Steps to test*\r\n1.Create an alloy project\r\n2. Replace index.js with the following code.\r\n3. Run the app\r\n5. Click on the red button to capture image\r\nObserve that a success message is shown on console and app didn't crash.\r\n\r\n*Test Case:*\r\n{code}\r\nvar cameraOverlay = Titanium.UI.createView({});\r\nvar cameraOverlayButton = Titanium.UI.createView({\r\n\tbottom : 10,\r\n\twidth : 100,\r\n\theight : 100,\r\n\tbackgroundColor : \"#f00\"\r\n});\r\ncameraOverlay.add(cameraOverlayButton);\r\ncameraOverlayButton.addEventListener('click', function(e) {\r\n\tTi.Media.takePicture();\r\n});\r\nfunction onOpen(argument) {\r\n\tTitanium.Media.showCamera({\r\n\t\toverlay : cameraOverlay,\r\n\t\tshowControls : false,\r\n\t\tsuccess : function(e) {\r\n\t\t\tTi.API.info('# SUCCESS : ' + JSON.stringify(e));\r\n\t\t},\r\n\t\tcancel : function(e) {\r\n\t\t\tTi.API.info('# CANCEL : ' + e.error);\r\n\t\t},\r\n\t\terror : function(e) {\r\n\t\t\tTi.API.info('# ERROR : ' + e.code + ' : ' + e.error);\r\n\t\t},\r\n\t\tmediaTypes : Ti.Media.MEDIA_TYPE_PHOTO,\r\n});\r\n}\r\n $.index.addEventListener(\"open\", onOpen);\r\n$.index.open();\r\n{code}\r\n\r\nThanks.", "updateAuthor": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2015-11-16T11:07:09.000+0000", "updated": "2015-11-22T11:43:08.000+0000" }, { "id": "371071", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "The problem was already fixed in another issue: https://github.com/appcelerator/titanium_mobile/pull/7394", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-11-22T13:34:46.000+0000", "updated": "2015-11-22T13:34:46.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }