Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16182] Android: Camera "cancel" function not called from Android "back" button when camera has overlay

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.2.0
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterAndrew Greenstreet
AssigneeUnknown
Created2014-01-13T20:09:09.000+0000
Updated2020-02-17T00:11:13.000+0000

Description

On Android using
Ti.Media.showCamera(
{
showControls: false,
autohide: true,
overlay: Ti.UI.createView({width:100, height:100, backgroundColor:"blue"}),
success: function(blob) { console.log("camera:success") },
error : function(e) { console.log("camera:error") },
cancel : function(e) { console.log("camera:cancel") }
});
Pressing the Android back button will not fire the "cancel" callback; However, when no overlay is specified, the cancel callback fires as expected.
Ti.Media.showCamera(
{
success: function(blob) { console.log("camera:success") },
error : function(e) { console.log("camera:error") },
cancel : function(e) { console.log("camera:cancel") }
});

Comments

  1. Andrew Greenstreet 2014-01-14

    TiCameraActivity Needs
       @Override
       	public void onBackPressed()
       	{
       		// Prevent default Android behavior for "back" press
       		//If there is a cancelcallback associated with this Camera, call it
       		if (cancelCallback != null) {
       			KrollDict dict = new KrollDict();
       			cancelCallback.callAsync(callbackContext, dict);
       		} 
       		super.onBackPressed();
       	}
       
  2. Ritu Agrawal 2014-01-14

    Moving this ticket to engineering as I can reproduce this issue with SDK 3.2.0 release and Samsung Galaxy Nexus device.
  3. Dominic Maricic 2020-02-17

    Has this really not been solved in 6 years? Is there a workaround?

JSON Source