Good afternoon coders! I have a slight problem that isn’t as easy as i thought it would be to solve. I am pretty sure you are all familiar with the Corona SDK Sample Apps< Camera app which is the following code:
-- Camera not supported on simulator. local isXcodeSimulator = "iPhone Simulator" == system.getInfo("model") if (isXcodeSimulator) then local alert = native.showAlert( "Information", "Camera API not available on iOS Simulator.", { "OK"}) end -- local bkgd = display.newRect( 0, 0, display.contentWidth, display.contentHeight ) bkgd:setFillColor( 128, 0, 0 ) local text = display.newText( "Tap anywhere to launch Camera", 0, 0, nil, 16 ) text:setTextColor( 255, 255, 255 ) text.x = 0.5 \* display.contentWidth text.y = 0.5 \* display.contentHeight local sessionComplete = function(event) local image = event.target print( "Camera ", ( image and "returned an image" ) or "session was cancelled" ) print( "event name: " .. event.name ) print( "target: " .. tostring( image ) ) if image then -- center image on screen image.x = display.contentWidth/2 image.y = display.contentHeight/2 local w = image.width local h = image.height print( "w,h = ".. w .."," .. h ) end end local listener = function( event ) if media.hasSource( media.Camera ) then media.show( media.Camera, sessionComplete ) else native.showAlert("Corona", "Camera not found.") end return true end bkgd:addEventListener( "tap", listener )
My problem is this: How can I use this code but DO NOT have to press the screen for the camera to appear. Basically I just want to open the app and instantly go to the camera view, how may I go about this or is it possible on Corona?
Thanks for any responses, gladly appreciated! Keep on coding !
- Julian