pichillilorenzo / flutter_inappwebview

A Flutter plugin that allows you to add an inline webview, to use a headless webview, and to open an in-app browser window.
https://inappwebview.dev
Apache License 2.0
3.26k stars 1.6k forks source link

Lost conection device when open camera #633

Open nsanchezce opened 3 years ago

nsanchezce commented 3 years ago

Enviroment

Technology Version
Flutter version 1.22
Plugin version 4.0.0+4
Android version 9
iOS version NA

Description

I'm trying to upload a file from the camera in my webview but It's not working in Android device. When I click on my Choose file button, it shows two options: camera and gallery. From Gallery everthing is ok, but choosing 'Camera', when it is openning , the device lose the conection. Although the camera is still open and i can take the photo, when i press the tic button it reload the app and don't load the picture. I am not getting any error.

Added this code in AndroidManifest file,

 <provider
            android:name="com.pichillilorenzo.flutter_inappwebview.InAppWebViewFileProvider"
            android:authorities="com.abc.sample.flutter_inappwebview.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths" />
        </provider>

Added permissions in AndroidManifest file and asked for them before start the webview:

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/>

Flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.5, on Microsoft Windows [Versión 10.0.18363.1256], locale es-ES)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Android Studio (version 3.6)
[√] VS Code, 64-bit edition (version 1.52.1)
[√] Connected device (1 available)

• No issues found!

Stacktrace/Logcat

Logs on debug console when click on camera

W/aprincipehotels( 8100): type=1400 audit(0.0:8710727): avc: granted { create } for name="image-1609840287533.jpg1773537374400873169.jpg" scontext=u:r:untrusted_app:s0:c252,c257,c512,c768 tcontext=u:object_r:sdcardfs:s0:c252,c257,c512,c768 tclass=file
D/ZrHung.AppEyeUiProbe( 8100): stop checker.
D/ZrHung.AppEyeUiProbe( 8100): Current Activity:false
D/ZrHung.AppEyeUiProbe( 8100): not watching, wait.
W/libEGL  ( 8100): EGLNativeWindowType 0x7d10f40010 disconnect failed
D/ViewRootImpl[MainActivity]( 8100): surface should not be released
W/libEGL  ( 8100): EGLNativeWindowType 0x7d2cde7010 disconnect failed
Lost connection to device.
Exited (sigterm)

Any help is welcome! Thanks!

selmi-ahmed commented 2 years ago

Same issue any help?!

basemasbahi commented 1 year ago

same issue ???????

ashlin-utrade commented 10 months ago

working in latest build(6.0.0-beta.31) after adding the following lines in AndroidManifest.xml (as mentioned in new docs):

<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>

[Documentation reference] (https://inappwebview.dev/docs/intro#configure-android)