[AC-2125] Open Photo Gallery and Show Camera Methods are not working on Android 4.0.4 version with Titanium Studio 3.1
| GitHub Issue | n/a | 
|---|---|
| Type | Bug | 
| Priority | n/a | 
| Status | Closed | 
| Resolution | Fixed | 
| Resolution Date | 2013-11-22T22:21:48.000+0000 | 
| Affected Version/s | n/a | 
| Fix Version/s | n/a | 
| Components | n/a | 
| Labels | n/a | 
| Reporter | Anuja Dharmadhikari | 
| Assignee | Mauro Parra-Miranda | 
| Created | 2013-11-12T04:37:57.000+0000 | 
| Updated | 2016-03-08T07:41:06.000+0000 | 
Description
	Methods for opening Photo gallery (openPhotoGallery) and Show Camera methods are not working on android 4.0.4 version 
Hello, We have tested this issue with the test code below. It’s working fine for us. Please try out this code to see if you can reproduce it. If you continue to encounter this issue, please send us your test sample. Regards,
Test Environment:
OS: MAC OS X 10.8.5 Ti SDK: 3.1.3 GA Ti CLI: 3.2.0 Android SDK 4.2.2 Device Android SDK 4.0.3 in EmulatorMy test code
var win = Ti.UI.createWindow(); var contenner = Ti.UI.createView({ width : Ti.UI.FILL, height : Ti.UI.SIZE, top : 0, backgroundColor : '#eee', borderColor : '#eee', layout : 'vertical', }); win.add(contenner); var anImageView = Ti.UI.createImageView({ width : 'auto', height : 'auto', top : 20, }); contenner.add(anImageView); var frmcamera = Ti.UI.createButton({ backgroundImage : 'none', backgroundColor : '#ff0000', title : 'Open Camera', color : '#fff', width : Ti.UI.SIZE, height : 50, font : { fontSize : 14, }, left : 10, }); frmcamera.addEventListener('click', function() { fireUpTheCamera(); }); contenner.add(frmcamera); var frmgalary = Ti.UI.createButton({ backgroundImage : 'none', backgroundColor : '#ff0000', title : 'Open Gallery', color : '#fff', width : Ti.UI.SIZE, height : 50, font : { fontSize : 14, }, right : 10, }); frmgalary.addEventListener('click', function() { Ti.Media.openPhotoGallery({ mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO], success : function(e) { anImageView.image = e.media; }, cancel : function() { }, error : function(err) { } }); }); contenner.add(frmgalary); function fireUpTheCamera() { Titanium.Media.showCamera({ success : function(event) { var cropRect = event.cropRect; var image = event.media; Ti.API.debug('Our type was: ' + event.mediaType); if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) { anImageView.image = image; } else { alert("got the wrong type back =" + event.mediaType); } }, cancel : function() { }, error : function(error) { // create alert var a = Titanium.UI.createAlertDialog({ title : 'Camera' }); // set message if (error.code == Titanium.Media.NO_CAMERA) { a.setMessage('Please run this test on device'); } else { a.setMessage('Unexpected error: ' + error.code); } // show alert a.show(); }, saveToPhotoGallery : true, allowEditing : true, mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO] }); } win.open();Step to test
1. Create a new project 2. Paste test code in app.js 3. Now run on android device/Emulator 4. Click on Open Gallery/ Open Camera button 5. Select photo from gallery or take photo from camera h5. Expect Result/Actual Result Working as expected.Working fine with 3.1.3
Not work with titanium_mobile 3.2.0.v20131122125648, at least "Show Camera". Tested in real android device 4.2.1 and Genymotion 2.1 with android 4.3
I confirm that working fine with 3.1.3.GA