android icon indicating copy to clipboard operation
android copied to clipboard

Can't find camera when using "Open Camera" app

Open rougerouter opened this issue 1 year ago • 6 comments

⚠️ Before posting ⚠️

  • [X] This is a bug, not a question or an enhancement.
  • [X] I've searched for similar issues and didn't find a duplicate.
  • [X] I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
  • [X] I agree to follow Nextcloud's Code of Conduct.

Steps to reproduce

Upload from Camera in Nextcloud app

Expected behaviour

Camera should open to take pic and upload.

Actual behaviour

No camera found

Android version

11

Device brand and model

Motorola Moto g power

Stock or custom OS?

Custom (explain in "additional information")

Nextcloud android app version

3.27

Nextcloud server version

27.1

Using a reverse proxy?

No

Android logs

No response

Server error logs

No response

Additional information

No response

rougerouter avatar Jan 19 '24 18:01 rougerouter

Works for me. Perhaps your phone removed camera permissions for the app? Can you check the permissions please?

joshtrichards avatar Jan 19 '24 19:01 joshtrichards

That was the first thing I checked. I am using Open Camera not Google Camera. I try to use as little of Google as possible. Thanks for checking.

On Fri, Jan 19, 2024, 2:58 PM Josh @.***> wrote:

Works for me. Perhaps your phone remove camera permissions for the app? Can you check the permissions please?

— Reply to this email directly, view it on GitHub https://github.com/nextcloud/android/issues/12393#issuecomment-1901026602, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABASMDETQGTSHLBREPZMYG3YPLGABAVCNFSM6AAAAABCCMLAOOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBRGAZDMNRQGI . You are receiving this because you authored the thread.Message ID: @.***>

rougerouter avatar Jan 19 '24 20:01 rougerouter

I am using Open Camera not Google Camera.

All we do is a fairly standard photo acquisition from the external registered camera app in the documented Android way:

https://developer.android.com/reference/android/provider/MediaStore.html#ACTION_IMAGE_CAPTURE

Can you get the debug logs? Either like this or by installing a Dev edition of the app and capturing the the logs from Settings->Logs (Dev edition can be installed in parallel with the regular app version; it'll use a different storage path locally?

joshtrichards avatar Jan 20 '24 14:01 joshtrichards

Hi @joshtrichards , I am also facing the issue with the Upload from camera option so I will give some information for debugging. OS: LineageOS version 20-20240126-NIGHTLY-instantnoodlep Nextcloud Android Version: 3.27.0 Camera App: org.lineageos.aperture version 13

As hard as I try I can not set Open Camera to be used by the Nextcloud App for uploading from camera.

logs.txt

Plus-Button (what is strange is the Document scan option is missing completely): Screenshot_20240201-123225_Trebuchet

When upload from camerais selected and picture is taken the app screen is freezing with this state. No options or anything. File is not created. Screenshot_20240201-123153_Trebuchet

Do you need further information?

Thanks and regards Enrico

enrico25 avatar Feb 01 '24 12:02 enrico25

As hard as I try I can not set Open Camera to be used by the Nextcloud App for uploading from camera.

@enrico25 In your case it sounds like a camera app (though not Open Camera) is being triggered so you're getting farther than @rougerouter at least. :-) What other camera app(s) do you have installed? The freezing one is one of them.

We don't have any way to control which camera app gets opened AFAIK. The Android OS basically handles the internals of the ACTION_IMAGE_CAPTURE intent. We just ask the OS to open its preferred camera app, give it an agreed upon filename, and use what we're given in that file.

@rougerouter In looking more at this, as long as permissions are granted (which we check for multiple times), a camera app should open. We only return "No Camera found" if the OS says there isn't a camera app installed/available. You marked "custom" as your OS so I presume you're using something like Lineage. Maybe it's some advanced security stuff? Open Camera also has a FAQ I recall looking at when I first reviewed your report, that had some steps for troubleshooting when it's not recognized.

In short: It sounds like the OS isn't providing us a camera app for some reason (in your case @rougerouter). And it sounds like the camera app being opened by the OS isn't fully functioning (in your case @enrico25). On the surface it doesn't seem like either of these situations are triggered by us / something we can fix in the client app. I'll leave open a bit to see if new info turns up though. Please follow-up here too if you find a solution in your respective situations.

joshtrichards avatar Feb 15 '24 15:02 joshtrichards

It's Libra, camera I am using. Open Camera doesn't work either. Google camera won't let you use Nextcloud. I wish I could get a Fairphone. Not in USA I'm afraid. Thanks for your help! Tom

On Thu, Feb 15, 2024, 10:27 AM Josh @.***> wrote:

As hard as I try I can not set Open Camera to be used by the Nextcloud App for uploading from camera.

@enrico25 https://github.com/enrico25 In your case it sounds like a camera app (though not Open Camera) is being triggered so you're getting farther than @rougerouter https://github.com/rougerouter at least. :-) What other camera app(s) do you have installed? The freezing one is one of them.

We don't have any way to control which camera app gets opened AFAIK. The Android OS basically handles the internals of the ACTION_IMAGE_CAPTURE intent. We just ask the OS to open its preferred camera app, give it an agreed upon filename, and use what we're given in that file.

@rougerouter https://github.com/rougerouter In looking more at this, as long as permissions are granted (which we check for multiple times), a camera app should open. We only return "No Camera found" if the OS says there isn't a camera app installed/available. You marked "custom" as your OS so I presume you're using something like Lineage. Maybe it's some advanced security stuff? Open Camera also has a FAQ I recall looking at when I first reviewed your report, that had some steps for troubleshooting when it's not recognized.

— Reply to this email directly, view it on GitHub https://github.com/nextcloud/android/issues/12393#issuecomment-1946323998, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABASMDE3GLBZE5F23D63MXLYTYSPBAVCNFSM6AAAAABCCMLAOOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBWGMZDGOJZHA . You are receiving this because you were mentioned.Message ID: @.***>

rougerouter avatar Feb 15 '24 15:02 rougerouter

Hi @joshtrichards , thanks for answering. I was awaiting the OS update before answering in hope that is fixed then. Unfortunately no... :-(

@enrico25 In your case it sounds like a camera app (though not Open Camera) is being triggered so you're getting farther than @rougerouter at least. :-) What other camera app(s) do you have installed? The freezing one is one of them.

OS tested: lineageOS 20 and 21 default lineageOS camera version:

  • Camera App: org.lineageos.aperture version 13
  • Camera App: org.lineageos.aperture version 14

As I am using lineageOS default camera app this is a more general problem, isn't it?

How do we handle? Can you re-test on lineageOS 20/21 please and provide feedback.

Thanks in advance and have a good start into the day.

Regards Enrico

enrico25 avatar Feb 19 '24 13:02 enrico25

Hi @joshtrichards , how are you doing? Haven't received any feedback yet. Shall I open a new bug ticket or how do we wanna continue?

Wish you a nice day.

Regards Enrico

enrico25 avatar Feb 29 '24 17:02 enrico25

As I am using lineageOS default camera app this is a more general problem, isn't it?

I don't have a Lineage test environment/device at the moment to verify.

The way the Camera is opened in Android by the Nextcloud client is very very simple.

Our code is basically textbook: https://github.com/nextcloud/android/blob/3e75f3523de4781f3a42bd033a6880329fb8b5a9/app/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java#L1077-1087

https://developer.android.com/media/camera/camera-intents#take_a_photo_with_a_camera_app

The only other thing we do here is ask the OS for a path to a directory on the primary shared/external storage device where the image can be placed:

https://github.com/nextcloud/android/blob/3e75f3523de4781f3a42bd033a6880329fb8b5a9/app/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java#L1097

This is fairly standard stuff and certainly works on stock Android.

If it's not working on your device I would assume it's one of:

  • a Lineage compatibility issue
  • something unique to Lineage's security model/settings
  • ?

But we can't open a camera in any simpler way on Android.

I agree we want it to work universally. But it seems unlikely we're doing anything wrong here since this works in stock Android + is a fairly textbook implementation of calling the Camera app.

(what is strange is the Document scan option is missing completely):

Unfortunately the scan option can't be compiled into the F-Droid builds at the moment so it's only in builds via other channels.

joshtrichards avatar Feb 29 '24 20:02 joshtrichards

I am using Libra camera. So no scan option with fdroid version huh? I will install the Play store version of Nextcloud client and see if anything changes with camera. Thanks Josh ! Tom

On Thu, Feb 29, 2024, 3:35 PM Josh @.***> wrote:

As I am using lineageOS default camera app this is a more general problem, isn't it?

I don't have a Lineage test environment/device at the moment to verify.

The way the Camera is opened in Android by the Nextcloud client is very very simple.

Our code is basically textbook:

https://github.com/nextcloud/android/blob/3e75f3523de4781f3a42bd033a6880329fb8b5a9/app/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java#L1077-1087

https://developer.android.com/media/camera/camera-intents#take_a_photo_with_a_camera_app

The only other thing we do here is ask the OS for a path to a directory on the primary shared/external storage device where the image can be placed:

https://github.com/nextcloud/android/blob/3e75f3523de4781f3a42bd033a6880329fb8b5a9/app/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java#L1097

This is fairly standard stuff and certainly works on stock Android.

If it's not working on your device I would assume it's one of:

  • a Lineage compatibility issue
  • something unique to Lineage's security model/settings
  • ?

But we can't open a camera in any simpler way on Android.

I agree we want it to work universally. But it seems unlikely we're doing anything wrong here since this works in stock Android + is a fairly textbook implementation of calling the Camera app.

(what is strange is the Document scan option is missing completely):

Unfortunately the scan option can't be compiled into the F-Droid builds at the moment so it's only in builds via other channels.

— Reply to this email directly, view it on GitHub https://github.com/nextcloud/android/issues/12393#issuecomment-1971914562, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABASMDFAGPHXUPS3PCF5PB3YV6IJXAVCNFSM6AAAAABCCMLAOOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZRHEYTINJWGI . You are receiving this because you were mentioned.Message ID: @.***>

rougerouter avatar Feb 29 '24 20:02 rougerouter

@enrico25 #12645 sounds like your situation. So I guess you're not alone. It does suggest the buttons are there but just not visible I guess. Weird.

joshtrichards avatar Mar 05 '24 02:03 joshtrichards