I am using the Titanium.Media.showCamera function, and I am trying to get an accelerometer reading associated with the photo.
The success function is triggered when the Use button is pressed, so the accelerometer reading I get in this function is the direction the iphone is pointing after the photo has already been taken. Is there any event triggered when the photo is actually taken, or any way to get the direction of the photo?
Thanks!
2 Answers
Use the takePicture method after calling showCamera and setting autohide to false. This will trigger the success callback, where you can grab the accelerometer data.
Titanium.Media.showCamera({ success:function(event) { Ti.API.info("picture was taken. Do something..."); var image = event.media; }, mediaTypes:Ti.Media.MEDIA_TYPE_PHOTO, autohide:false }); Titanium.Media.takePicture();
Excellent. I haven't tried it yet, but thanks very much, Terry.
UPDATE: unfortunately, I couldn't get this to work. There is still an additional button press ("Use" or "Cancel" this photo) required before success gets triggered.
Your Answer
Think you can help? Login to answer this question!