Camera bug

antkmk,

I saw your post but did not have time to react to it so I almost ignored it. I apologize. I will try your solution soon and update. Crossing my fingers.

Thanks!

Hi guys,

this is my frist post, but I hope can help someone.

I had the same problem, I tried many different approach to solve it, but nothing work.

At least the solution was really easy ( but really unpredictable)

To Fix the unsupported camera problem, you just have to use the old way of declare Android permission in build.setting

Use

[lua]

androidPermissions = {

                “android.permission.INTERNET”,

                “android.permission.CAMERA”,

                “android.permission.WRITE_EXTERNAL_STORAGE”,

                “android.permission.ACCESS_FINE_LOCATION”,

                “android.permission.ACCESS_NETWORK_STATE”,

                “android.permission.READ_PHONE_STATE”,

},

[/lua]

instead of

[lua]

usesPermissions = {

“android.permission.INTERNET”,

“android.permission.CAMERA”,

“android.permission.WRITE_EXTERNAL_STORAGE”,

“android.permission.ACCESS_FINE_LOCATION”,

“android.permission.ACCESS_NETWORK_STATE”,

“android.permission.READ_PHONE_STATE”,

},

[/lua]

Hi @gasnervino,

Did you set up your “build.settings” in the exact structure as shown in this link under “Android Build Settings”?

http://docs.coronalabs.com/guide/distribution/buildSettings/index.html#androidsettings

Best regards,

Brent

I have not been able to play with the camera lately. My app’s target device is the iPad which works  as per my previous post a while back. It turns out that it also works in android on a new htc one as well. I did not have to modify the permissions in any way shape or form, but it might be a solution for other devices, as posted. I have one last problem with iPad which it seems to crop the image no matter how I display it on the screen prior to saving it. It looks cropped or offset even in the file. This is my latest code.

function onBackFromCamera(event)

    local photo=event.target

    if photo then

        photo:setReferencePoint(display.CenterReferencePoint)

        photo.width=SCREEN_W – display.contentWidth

        photo.height=SCREEN_H – display.contentHeight

        photo.x=display.contentCenterX

        photo.y=display.contentCenterY

        local file=‘IMG_’…string.format(’%06d’,getNextPicNum(db))…’.jpg’

        display.save(photo,file,system.DocumentsDirectory)

        photo.isVisible=false

        showPicture(file) – this function just displays the picture

    end

end

local function onCamera(event) – camera button

    if not event or event.phase==‘ended’ then

        if media.hasSource(media.Camera) then

            media.show(media.Camera,onBackFromCamera)

        else

            native.showAlert(‘App’,‘This device does not have a camera.’,{‘OK’})

        end

    end

end

Hi guys,

this is my frist post, but I hope can help someone.

I had the same problem, I tried many different approach to solve it, but nothing work.

At least the solution was really easy ( but really unpredictable)

To Fix the unsupported camera problem, you just have to use the old way of declare Android permission in build.setting

Use

[lua]

androidPermissions = {

                “android.permission.INTERNET”,

                “android.permission.CAMERA”,

                “android.permission.WRITE_EXTERNAL_STORAGE”,

                “android.permission.ACCESS_FINE_LOCATION”,

                “android.permission.ACCESS_NETWORK_STATE”,

                “android.permission.READ_PHONE_STATE”,

},

[/lua]

instead of

[lua]

usesPermissions = {

“android.permission.INTERNET”,

“android.permission.CAMERA”,

“android.permission.WRITE_EXTERNAL_STORAGE”,

“android.permission.ACCESS_FINE_LOCATION”,

“android.permission.ACCESS_NETWORK_STATE”,

“android.permission.READ_PHONE_STATE”,

},

[/lua]

Hi @gasnervino,

Did you set up your “build.settings” in the exact structure as shown in this link under “Android Build Settings”?

http://docs.coronalabs.com/guide/distribution/buildSettings/index.html#androidsettings

Best regards,

Brent

I have not been able to play with the camera lately. My app’s target device is the iPad which works  as per my previous post a while back. It turns out that it also works in android on a new htc one as well. I did not have to modify the permissions in any way shape or form, but it might be a solution for other devices, as posted. I have one last problem with iPad which it seems to crop the image no matter how I display it on the screen prior to saving it. It looks cropped or offset even in the file. This is my latest code.

function onBackFromCamera(event)

    local photo=event.target

    if photo then

        photo:setReferencePoint(display.CenterReferencePoint)

        photo.width=SCREEN_W – display.contentWidth

        photo.height=SCREEN_H – display.contentHeight

        photo.x=display.contentCenterX

        photo.y=display.contentCenterY

        local file=‘IMG_’…string.format(’%06d’,getNextPicNum(db))…’.jpg’

        display.save(photo,file,system.DocumentsDirectory)

        photo.isVisible=false

        showPicture(file) – this function just displays the picture

    end

end

local function onCamera(event) – camera button

    if not event or event.phase==‘ended’ then

        if media.hasSource(media.Camera) then

            media.show(media.Camera,onBackFromCamera)

        else

            native.showAlert(‘App’,‘This device does not have a camera.’,{‘OK’})

        end

    end

end