Android 6 bug: camera not found compiling with CoronaSDK 2016.2830

On CoronaSDK 2016.2830 there’s a bug I tested on LG G4 (Android 6).

The camera is not detected.

Hi angelo.geminiani,

Is there any more detail you can give us about this issue? Specifically, are you seeing this when running through the Camera sample app included with Corona SDK, or is this just now happening in your own app?

As we announced here, Corona SDK Android builds now target the latest API Level (23). This means that the new runtime permission model is now enforced on Corona-built apps from daily build 2016.2828 and later.

You may now be seeing that the Camera isn’t detected because your app doesn’t initially have permission to access it anymore.

This are my permissions:

usesPermissions = {

            – ALLOW CALL TO CONTACTS

            “android.permission.CALL_PHONE”,

            

            – Required by the MapView to fetch its contents from the Google Maps servers.

            “android.permission.INTERNET”,

            

            – Optional permission used to display current location via the GPS.

            “android.permission.ACCESS_FINE_LOCATION”,

            

            – Optional permission used to display current location via WiFi or cellular service.

            “android.permission.ACCESS_COARSE_LOCATION”,

            

            “android.permission.WRITE_EXTERNAL_STORAGE”,

            

            “android.permission.CAMERA”,

            “android.permission.WRITE_EXTERNAL_STORAGE”,

            

            --vibrate

            “android.permission.VIBRATE”,

            

            --push notifications

            --“android.permission.INTERNET”,

            “android.permission.GET_ACCOUNTS”,

            “android.permission.RECEIVE_BOOT_COMPLETED”,

            “com.google.android.c2dm.permission.RECEIVE”,

            “.permission.C2D_MESSAGE”,

            

            

        },

Hmm… ruling out some weird behavior with including a the same permission multiple times, what happens with this usesPermission table?

usesPermissions = { -- ALLOW CALL TO CONTACTS "android.permission.CALL\_PHONE", -- Required by the MapView to fetch its contents from the Google Maps servers. "android.permission.INTERNET", -- Optional permission used to display current location via the GPS. "android.permission.ACCESS\_FINE\_LOCATION", -- Optional permission used to display current location via WiFi or cellular service. "android.permission.ACCESS\_COARSE\_LOCATION", "android.permission.CAMERA", "android.permission.WRITE\_EXTERNAL\_STORAGE", --vibrate "android.permission.VIBRATE", --push notifications "android.permission.GET\_ACCOUNTS", "android.permission.RECEIVE\_BOOT\_COMPLETED", "com.google.android.c2dm.permission.RECEIVE", ".permission.C2D\_MESSAGE", },

To reiterate my earlier question, are you seeing this when running through the Camera sample app included with Corona SDK?

Assuming it’s still an issue with the above usesPermissions table and occurs in our Camera sample, it could be an issue with LG’s Android fork.

I didn’t try with the Camera sample.

I’ll try soon and write here further details.

Found the problem.

Problem was not in usePermissions, but in useFeatures missing “android.hardware.camera”.

Adding this solved:

usesFeatures = {

            { name = “android.hardware.camera”, required = true },

            { name = “android.hardware.camera.front”, required = false },

        }

Thanks Ajay for your help.

I ask you one more question:

Do you think my usePermissions have something wrong?

Why did you said “including a the same permission multiple times”?

I cannot find same permission repeated.

No problem. Glad the solution was simple.

To answer your second question, I noticed that  “android.permission.WRITE_EXTERNAL_STORAGE” appeared twice in the usesPermissions table you provided in an earlier post.

The thinking there was that maybe having the same permission multiple times was causing undesired behavior on your LG G4 with Android 6.

Thank you, I didn’t see that “android.permission.WRITE_EXTERNAL_STORAGE” was repeated twice.

Thank you very much.

Hi angelo.geminiani,

Is there any more detail you can give us about this issue? Specifically, are you seeing this when running through the Camera sample app included with Corona SDK, or is this just now happening in your own app?

As we announced here, Corona SDK Android builds now target the latest API Level (23). This means that the new runtime permission model is now enforced on Corona-built apps from daily build 2016.2828 and later.

You may now be seeing that the Camera isn’t detected because your app doesn’t initially have permission to access it anymore.

This are my permissions:

usesPermissions = {

            – ALLOW CALL TO CONTACTS

            “android.permission.CALL_PHONE”,

            

            – Required by the MapView to fetch its contents from the Google Maps servers.

            “android.permission.INTERNET”,

            

            – Optional permission used to display current location via the GPS.

            “android.permission.ACCESS_FINE_LOCATION”,

            

            – Optional permission used to display current location via WiFi or cellular service.

            “android.permission.ACCESS_COARSE_LOCATION”,

            

            “android.permission.WRITE_EXTERNAL_STORAGE”,

            

            “android.permission.CAMERA”,

            “android.permission.WRITE_EXTERNAL_STORAGE”,

            

            --vibrate

            “android.permission.VIBRATE”,

            

            --push notifications

            --“android.permission.INTERNET”,

            “android.permission.GET_ACCOUNTS”,

            “android.permission.RECEIVE_BOOT_COMPLETED”,

            “com.google.android.c2dm.permission.RECEIVE”,

            “.permission.C2D_MESSAGE”,

            

            

        },

Hmm… ruling out some weird behavior with including a the same permission multiple times, what happens with this usesPermission table?

usesPermissions = { -- ALLOW CALL TO CONTACTS "android.permission.CALL\_PHONE", -- Required by the MapView to fetch its contents from the Google Maps servers. "android.permission.INTERNET", -- Optional permission used to display current location via the GPS. "android.permission.ACCESS\_FINE\_LOCATION", -- Optional permission used to display current location via WiFi or cellular service. "android.permission.ACCESS\_COARSE\_LOCATION", "android.permission.CAMERA", "android.permission.WRITE\_EXTERNAL\_STORAGE", --vibrate "android.permission.VIBRATE", --push notifications "android.permission.GET\_ACCOUNTS", "android.permission.RECEIVE\_BOOT\_COMPLETED", "com.google.android.c2dm.permission.RECEIVE", ".permission.C2D\_MESSAGE", },

To reiterate my earlier question, are you seeing this when running through the Camera sample app included with Corona SDK?

Assuming it’s still an issue with the above usesPermissions table and occurs in our Camera sample, it could be an issue with LG’s Android fork.

I didn’t try with the Camera sample.

I’ll try soon and write here further details.

Found the problem.

Problem was not in usePermissions, but in useFeatures missing “android.hardware.camera”.

Adding this solved:

usesFeatures = {

            { name = “android.hardware.camera”, required = true },

            { name = “android.hardware.camera.front”, required = false },

        }

Thanks Ajay for your help.

I ask you one more question:

Do you think my usePermissions have something wrong?

Why did you said “including a the same permission multiple times”?

I cannot find same permission repeated.

No problem. Glad the solution was simple.

To answer your second question, I noticed that  “android.permission.WRITE_EXTERNAL_STORAGE” appeared twice in the usesPermissions table you provided in an earlier post.

The thinking there was that maybe having the same permission multiple times was causing undesired behavior on your LG G4 with Android 6.

Thank you, I didn’t see that “android.permission.WRITE_EXTERNAL_STORAGE” was repeated twice.

Thank you very much.