Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera in webview android is opened. But when I press 'ok' button in camera. The Image is not uploaded. #2313

Closed
RaisHelmy opened this issue Oct 1, 2024 · 7 comments

Comments

@RaisHelmy
Copy link

Hi Everyone, this is not an bug but a question

I use this library but it seems that the camera photos is not uploaded in html.

I already grant access to camera and storage but upon clicking camera, the camera is opened and capturing image on android phone but after clicking 'ok' it doesnt attach file to photo

Copy link

github-actions bot commented Oct 1, 2024

👋 @RaisHelmy

NOTE: This comment is auto-generated.

Are you sure you have already searched for the same problem?

Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!

If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.

In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE] or ios WKWebView [MY ERROR HERE] keywords.

Following these steps can save you, me, and other people a lot of time, thanks!

@RaisHelmy
Copy link
Author

Yes, I already checked the same issue. In internet most of it solved by adding Android Photo, Camera, Storage permission. I have done that and I already opened the camera, just that photo from camera is not uploaded.

@rhowelp
Copy link

rhowelp commented Oct 7, 2024

Same issue with me. Uploading via file picker is working but I need to upload a photo using camera, but I can't capture the photo.
Or maybe another work around how to hide the choosing a photo from camera?

@boonkahming
Copy link

boonkahming commented Oct 26, 2024

I am also facing the same issue with Android 13 & 14 devices, the camera launched, and after taking the photo and clicked on "Use Photo", nothing is being uploaded to the photo uploader plugin.

However, the camera photo upload works fine on iPadOS 17.

I am using flutter_inappwebview: ^6.1.5 version.

@boonkahming
Copy link

Hey everyone! My camera photo is able to upload the image to the uploader input now. Below are the setups that need to done.

1. Make sure to request for camera permission in your main() method.

import 'package:permission_handler/permission_handler.dart';

Future main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Permission.camera.request();
  await Permission.microphone.request(); // if you need microphone permission

  runApp(MyApp());
}

2. Make sure to have the below permissions in your AndroidManifest.xml

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.VIDEO_CAPTURE" />
<uses-permission android:name="android.permission.AUDIO_CAPTURE" />

3. Make sure to also add the below block in your AndroidManifest.xml

<provider
    android:name="com.pichillilorenzo.flutter_inappwebview_android.InAppWebViewFileProvider"
    android:authorities="${applicationId}.flutter_inappwebview_android.fileprovider"
    android:exported="false"
    android:grantUriPermissions="true">
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/provider_paths" />
</provider>

This is officially documented in the documentation.
https://inappwebview.dev/docs/intro#enable-camera-for-html-inputs

@RaisHelmy
Copy link
Author

Thanks Bookahming

Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants