local function getImages(event) fName = os.time(os.date("!\*t")) local hasAccessToCamera, hasCamera local hasAccessToCamera, hasCamera = media.hasSource( media.Camera ) if ( hasAccessToCamera == true ) then -- There is access to the camera media.capturePhoto( { listener = onComplete } ) elseif ( hasCamera == true and native.canShowPopup( "requestAppPermission" ) ) then local function appPermissionsListener( event ) for k,v in pairs( event.grantedAppPermissions ) do if ( v == "Camera" ) then print("we got camera") timer.performWithDelay(300, getImages,1) return end end timer.performWithDelay(300, backArrowListener, 1) end local options = { appPermission = "Camera", urgency = "Critical", listener = appPermissionsListener, rationaleTitle = "Camera access required", rationaleDescription = "Camera access is required to take photos. Re-request now?", -- settingsRedirectTitle = "Alert", -- settingsRedirectDescription = "Without the ability to take photos, this app cannot properly function. Please grant camera access within Settings." } native.showPopup( "requestAppPermission", options ) end we dont crash on it, below is from logcat my print: 02-24 15:55:11.225 10235 10252 I Corona : applicationExit or applicationSuspend: db closed your print: 02-24 15:55:13.215 10235 10235 D Corona : Execute the lua listener task your print: 02-24 15:55:13.215 10235 10235 I Corona : ERROR: CoronaActivity.DefaultRequestPermissiosnResultHandler.forwardRequestPermissionsResultToLua():Cannot forward results to Lua as no registry ID was found! my print: 02-24 15:55:13.265 10235 10252 I Corona : db opened my print: 02-24 15:55:13.265 10235 10252 I Corona : db reopened
local function getImages(event) fName = os.time(os.date("!\*t")) local hasAccessToCamera, hasCamera local hasAccessToCamera, hasCamera = media.hasSource( media.Camera ) if ( hasAccessToCamera == true ) then -- There is access to the camera media.capturePhoto( { listener = onComplete } ) elseif ( hasCamera == true and native.canShowPopup( "requestAppPermission" ) ) then local function appPermissionsListener( event ) for k,v in pairs( event.grantedAppPermissions ) do if ( v == "Camera" ) then print("we got camera") timer.performWithDelay(300, getImages,1) return end end timer.performWithDelay(300, backArrowListener, 1) end local options = { appPermission = "Camera", urgency = "Critical", listener = appPermissionsListener, rationaleTitle = "Camera access required", rationaleDescription = "Camera access is required to take photos. Re-request now?", -- settingsRedirectTitle = "Alert", -- settingsRedirectDescription = "Without the ability to take photos, this app cannot properly function. Please grant camera access within Settings." } native.showPopup( "requestAppPermission", options ) end we dont crash on it, below is from logcat my print: 02-24 15:55:11.225 10235 10252 I Corona : applicationExit or applicationSuspend: db closed your print: 02-24 15:55:13.215 10235 10235 D Corona : Execute the lua listener task your print: 02-24 15:55:13.215 10235 10235 I Corona : ERROR: CoronaActivity.DefaultRequestPermissiosnResultHandler.forwardRequestPermissionsResultToLua():Cannot forward results to Lua as no registry ID was found! my print: 02-24 15:55:13.265 10235 10252 I Corona : db opened my print: 02-24 15:55:13.265 10235 10252 I Corona : db reopened
So, if you already have just Camera permission (and not Storage permission), it will ‘automatically’ ask for Storage permission when the ‘media.capturePhoto()’ is called. When the Storage permission is given, there is no call back function and thus this error occurs.
To solve this, I ask for Storage permission first, and if given, then only I will ask for the Camera permission.
So, if you already have just Camera permission (and not Storage permission), it will ‘automatically’ ask for Storage permission when the ‘media.capturePhoto()’ is called. When the Storage permission is given, there is no call back function and thus this error occurs.
To solve this, I ask for Storage permission first, and if given, then only I will ask for the Camera permission.