Determine source of selectPhoto call

Hi all,

I’m using media.selectPhoto in two different instance - one for getting photos from the camera, and the other from the photoLibrary. I would like to use the same handler for both (handlePhotoComplete) but I need a way of determining if the photo came from the camera or library.

I know how to pass a parameter when the listener is attached to a display object, but can I pass “source” somehow based on the code below? Each is in a different function that is called by a camera or library button.

Here is the code for the camera function. The library is similar but uses media.selectPhoto instead:

 getCameraPhoto = function (e) -- get a photo from the camera if ( e.phase == "ended" ) then if media.hasSource( media.PhotoLibrary ) then media.capturePhoto( { listener = handlePhotoComplete} ) else native.showAlert( \_G.appName, "This device does not have access to a camera.", { "OK" } ) end end return true end