{ "id": "167659", "key": "AC-4967", "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": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2017-05-18T13:26:11.000+0000", "created": "2017-05-17T02:49:33.000+0000", "labels": [ "Ti.Media.openPhotoGallery", "android" ], "versions": [ { "id": "17038", "name": "Appcelerator Studio 4.5.0", "archived": false, "released": false } ], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2017-05-18T13:26:11.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": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "The code snippet below successfully opens the photo gallery. However, once a photo(s) is selected, the app immediately crashes.\r\n\r\nNo error message in the console. Just the generic Android message of \"myApp keeps stopping\"\r\n\r\nThis bug does not seem to affect other devices with API 24 or 23. No specific pattern discovered yet, except that it definitely crashes on the Google Pixel API 25 emulator and the real device.\r\n\r\n{code}\r\nTi.Media.openPhotoGallery({\r\n allowMultiple: true,\r\n \r\n success: function(e) {\r\n Ti.API.info(JSON.stringify(e));\r\n },\r\n cancel: function() { },\r\n error: function() { }\r\n });\r\n{code}", "attachment": [], "flagged": false, "summary": "Selecting a photo (Ti.Media.openPhotoGallery) on Google Pixel (API 25) crashes immediately", "creator": { "name": "ch", "key": "ch", "displayName": "Cameron", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "ch", "key": "ch", "displayName": "Cameron", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Genymotion Simulator Google Pixel 7.1.0 API 25\r\nmacOS 10.12\r\nTi SDK 6.0.4.GA", "comment": { "comments": [ { "id": "419863", "author": { "name": "ch", "key": "ch", "displayName": "Cameron", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Sorry, for some reason the system doesn't let me post issues to TIMOB.\r\n\r\nOnly to either Appcelerator - Inbox or Aptana Studio. Not sure if that is by design, but if I made a mistake in where to file this, my appologies", "updateAuthor": { "name": "ch", "key": "ch", "displayName": "Cameron", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-05-17T02:52:39.000+0000", "updated": "2017-05-17T02:52:39.000+0000" }, { "id": "419891", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, Are you providing the storage permission during run-time? Try using the below code. \r\n{code}\r\nvar cameraPermission = \"android.permission.CAMERA\";\r\n\r\nvar storagePermission = \"android.permission.READ_EXTERNAL_STORAGE\";\r\n\r\nvar hasCameraPermission = Ti.Android.hasPermission(cameraPermission);\r\n\r\nvar hasStoragePermission = Ti.Android.hasPermission(storagePermission);\r\n\r\nvar permissionsToRequest = [];\r\n\r\nif (!hasCameraPermission) {\r\n\r\n permissionsToRequest.push(cameraPermission);\r\n\r\n}\r\n\r\nif (!hasStoragePermission) {\r\n\r\n permissionsToRequest.push(storagePermission);\r\n\r\n}\r\n\r\nif (permissionsToRequest.length > 0) {\r\n\r\n Ti.Android.requestPermissions(permissionsToRequest, function(e) {\r\n\r\n if (e.success) {\r\n\r\n Ti.API.info(\"SUCCESS\");\r\n\r\n } else {\r\n\r\n Ti.API.info(\"ERROR: \" + e.error);\r\n\r\n }\r\n\r\n });\r\n\r\n}\r\nvar win = Titanium.UI.createWindow();\r\n\r\nvar btn = Ti.UI.createButton({\r\n\r\n title : 'Open Gallery',\r\n top : 10\r\n\r\n});\r\n\r\nvar imageView = Ti.UI.createImageView({\r\n top : 100,\r\n height : 200,\r\n weidth : 200\r\n});\r\nwin.add(imageView);\r\n\r\nbtn.addEventListener('click', function() {\r\n\r\n Ti.Media.openPhotoGallery({\r\n\r\n mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO],\r\n\r\n success : function(e) {\r\n imageView.image = e.media;\r\n\r\n\r\n },\r\n\r\n cancel : function() {\r\n },\r\n\r\n error : function(e) {\r\n\r\n Ti.API.error(JSON.stringify(e));\r\n\r\n }\r\n });\r\n\r\n});\r\n\r\nwin.add(btn);\r\n\r\nwin.open();\r\n{code}\r\n\r\nTiapp.xml in Android section.\r\n{code}\r\n \r\n \r\n{code}\r\n\r\nThanks.\r\n", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2017-05-17T15:40:22.000+0000", "updated": "2017-05-17T15:40:22.000+0000" }, { "id": "419927", "author": { "name": "ch", "key": "ch", "displayName": "Cameron", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Ok well, you are a genius. Sorry I didn't know about these permissions.\r\n\r\nThat solved it!", "updateAuthor": { "name": "ch", "key": "ch", "displayName": "Cameron", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-05-18T05:52:35.000+0000", "updated": "2017-05-18T05:52:35.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }