Add basic camera support to the android device #5903
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
This PR adds basic camera support to the android device via a new
CameraDeviceinterface. TheCapturePhotofunction launches an intent to open the camera app, and returns when the user is finished in the camera app. It returns an image, if an image was taken, and any errors.I also standardized the java file on 4 space indent, since there was a mix of tabs and spaces in there, and 4 spaces seems to be the norm for java.
Requires fyne-io/tools#78 to build
Example App
Here's an example app to test with:
Which looks this like:
camerademo.mp4
Unfortunately, the resolution of the resulting image is very small (192 × 255 pixels), which is a known issue when getting data back from
MediaStore.ACTION_IMAGE_CAPTUREthis way. It seems our only option for getting higher resolution images via the intent is to have the app write to a temp file we can open onActivityResult. See:https://issuetracker.google.com/issues/36906325
https://medium.com/@appgeniuz08/capture-photo-via-intent-in-android-66749be91b9d
https://commonsware.com/blog/2015/06/08/action-image-capture-fallacy.html
Checklist:
Where applicable: