Skip to content

On my Android (Galaxy S10) not opening the camera or gallery #129428

Closed
@jopmiddelkamp

Description

@jopmiddelkamp

Is there an existing issue for this?

Steps to reproduce

If I follow the steps below on my Android device nothing happens while on my iOS device everything works fine. This is exactly the same behaviour as when we load one of or partner their web views into our app.

  1. Clone the flutter_webview_issue repo
  2. Run the app on your device
  3. Tap on either the gallery or camera button

Expected results

For the web view to open either the gallery or the camera based on the button you've pressed.

Actual results

Nothing happens.

Code sample

Source from our flutter_webview_issue repo.

Code sample
void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: WebViewContainer(),
      debugShowCheckedModeBanner: false,
    );
  }
}

class WebViewContainer extends StatefulWidget {
  const WebViewContainer({super.key});

  @override
  State<WebViewContainer> createState() => _WebViewContainerState();
}

class _WebViewContainerState extends State<WebViewContainer> {
  final _url =
      'https://6495ac7394575140f22df7b5--react-native-photo-gallery-apis.netlify.app/';
  WebViewController? webViewController;

  @override
  void initState() {
    [
      Permission.photos,
      Permission.camera,
      Permission.mediaLibrary,
      Permission.videos,
    ].request().then((value) {
      webViewController = WebViewController()
        ..setJavaScriptMode(JavaScriptMode.unrestricted)
        ..loadRequest(Uri.parse(_url));
      setState(() {});
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('WebView')),
      body: webViewController != null
          ? WebViewWidget(
              controller: webViewController!,
            )
          : const Center(child: CircularProgressIndicator()),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

log.txt

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.10.4, on macOS 13.3.1 22E772610a darwin-arm64, locale en-GB)
    • Flutter version 3.10.4 on channel stable at /Users/jopmiddelkamp/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 682aa387cf (3 weeks ago), 2023-06-05 18:04:56 -0500
    • Engine revision 2a3401c9bb
    • Dart version 3.0.3
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/jopmiddelkamp/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Users/jopmiddelkamp/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/221.6008.13.2211.9514443/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.12.1

[✓] Android Studio (version 2022.1)
    • Android Studio at /Users/jopmiddelkamp/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/221.6008.13.2211.9514443/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)

[✓] Android Studio (version 2022.1)
    • Android Studio at /Users/jopmiddelkamp/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/221.6008.13.2211.9619390/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)

[✓] VS Code (version 1.79.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.66.0

[✓] Connected device (2 available)
    • SM G973F (mobile) • R58N94GTXNE • android-arm64 • Android 12 (API 31)
    • macOS (desktop)   • macos       • darwin-arm64  • macOS 13.3.1 22E772610a darwin-arm64

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: solvedIssue is closed as solved

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions