Problem
SaveToPhotoGallery:false does not work in android.
Reproducible steps:
1. Run the code below
Expected behavior:
Customer does not want to save the image to the gallery after taking a picture.
More info:
In iOS works well.
http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Media.showCamera-method.html
saveToPhotoGalleryboolean if the media should be saved to the photo gallery upon successful capture.
Tested with the next specs:
Samsung Galaxy Fit-Android Version : 2.2.1
iPhone 3G Version: 4.3.5
Simulator
Titanium Studio, build: 1.0.7.201111231202
Titanium SDK: 1.8.0.v20111114103905
Google APIs Android 2.3.3
Sample code:
var mwin = Ti.UI.createWindow({
backgroundColor : 'orange'
});
var btnShowCamera = Ti.UI.createButton({
title : 'Take picture',
width : 150,
height : 70,
top : 50
});
mwin.add(btnShowCamera);
btnShowCamera.addEventListener('click', function(e)
{
var win = Titanium.UI.currentWindow;
Titanium.Media.showCamera(
{
mediaTypes : Titanium.Media.MEDIA_TYPE_PHOTO,
allowEditing : true,
saveToPhotoGallery:true,
success : function(event)
{
var cropRect = event.cropRect;
var image = event.media;
var imageView = Titanium.UI.createImageView(
{
image : image,
width : 480,
height : 640
});
image = imageView.toBlob();
var photoPath = '';
var photoDir = '';
if(Titanium.Filesystem.isExternalStoragePresent())
{
photoDir = Titanium.Filesystem.getFile(Titanium.Filesystem.externalStorageDirectory, 'PlayGroundPhotos');
if(!photoDir.exists())
{
photoDir.createDirectory();
}
}
photoPath = photoDir.nativePath;
var f = Titanium.Filesystem.getFile(photoPath, 'tony.jpg');
f.write(image);
},
cancel : function()
{
},
});
});
mwin.open();
Helpdesk
APP-344567
I also reproduced the similar behavior: when saveToPhotoGallery=false, picture is saved in Camera folder, as well as folder named
Is there any update on this issue, we are facing it in 2.0.2 as well. When placing saveToPhotoGallery:false, it does get saved in the DCIM/Camera/My_APP
@Vinothbabu - We are not able to reproduce this issue with the latest master build (2.1.0). Please try your application with the latest build and see if it resolves the issue.
The issue is still occurring, I was able to reproduce using 2.1.1GA and the latest master build (2.2.0).
What is the criteria being used to determine if a picture gets saved to the gallery here? I wouldn't expect that criteria to be whether the photo shows up in the Android Gallery app -- that app can find photos anywhere in phone storage in Android 4.0. The Appcelerator docs says this about saveToPhotoGallery: saveToPhotoGallery : Boolean Specifies if the media should be saved to the photo gallery upon successful capture. Defaults to: False I tried the code above, these are the results on Samsung Galaxy S3 (Sprint) running Android 4.0: (1) saveToPhotoGallery=true Image is saved to /mnt/sdcard/Pictures/
I think the customer is asking to not save an extra copy of a photo -- it doesn't look like the saveToPhotoGallery option was intended to do that. I talked to Josh, and he pointed out that some camera apps from various manufacturers don't give the user an option not to do this. An alternative is to use an overlay as described here to avoid using the in-device camera app: http://docs.appcelerator.com/titanium/2.1/index.html#!/api/CameraOptionsType
Resolving this ticket in the correct status as we were not able to reproduce the issue reported in this ticket.
This is still happening on Ti SDK 3.1.2.GA Tested on several devices (Android 4.0, 4.1, 4.2 and 4.3) Devices: Nexus 7 (2013), Samsung Galaxy S2, Samsung Galaxy S3, Samsung Galaxy S4, LG L5, Motorola Razr PhoneGap solved this as per: http://simonmacdonald.blogspot.ca/2012/07/change-to-camera-code-in-phonegap-190.html
any news on this one?