Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14423] Android: Pressing home button of device on camera overlay in portrait mode and re-opening the app gives an error message

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2013-07-02T18:14:58.000+0000
Affected Version/sRelease 3.1.1
Fix Version/sn/a
ComponentsAndroid
Labelsandroid
ReporterMukund Samant
AssigneeIngo Muschenetz
Created2013-05-22T06:26:43.000+0000
Updated2017-03-16T21:01:23.000+0000

Description

*Problem* Pressing home button of an Android device on camera overlay(which is in portrait mode) and re opening the app gives an error message in an alert box. *Test Case* 1. Open the camera from a portrait mode screen
var win = Ti.UI.createWindow({
	backgroundColor : '#FFF'
});
var label = Ti.UI.createLabel({
	text : "Tap to show camera"
});
win.add(label);
win.open();

var cameraOverlayView = Ti.UI.createView({
	height : '100%',
	width : '100%'
});

win.addEventListener('click', function() {
	var params = {
		success : function(e) {
			Ti.API.info('SUCCESS');
		},
		error : function(e) {
			alert('ERROR ' + JSON.stringify(e));
		},
		cancel : function(e) {
			Ti.API.info('CANCEL ' + e);
		},
		mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO],
		overlay : cameraOverlayView

	};
	Ti.Media.showCamera(params);
});
2. Press Home button of Android device. 3. Re open the app. 4. The camera screen disappears and the following message is seen in an alert box:
{ "message": "Unable to setup preview surface:null" ,"code":-1,"error":"Unable to setup preview surface:null","success":false}

Comments

  1. Mukund Samant 2013-05-28

    Hi Any updates on this?Please let me know if more elaboration is required in the test case.
  2. Daniel Sefton 2013-06-27

    Tested and confirmed on Samsung Galaxy S2 2.3.6 with Ti SDK 3.1.1 GA. However, I don't get the "Unable to setup preview surface" error.
  3. Biju pm 2013-06-28

    Pull request https://github.com/appcelerator/titanium_mobile/pull/4425
  4. Hieu Pham 2013-07-02

    Updated test case. Should now see an alert with error in fail case.
  5. Blaga Mihai 2013-08-08

    The problem still exists on 3.1.1.GA, 3.1.2.v20130730133101, 3.1.2.v20130807111603 but it's fixed on 3.2.0.v20130807110843. The problem appears when locking the screen also. Can't the fix be included in the final 3.1.2?
  6. Lee Morris 2017-03-16

    Closing ticket as fixed.

JSON Source