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

Unable to Download Files Using flutter_inappwebview in Flutter #1698

Open
CartmanGD opened this issue Jun 18, 2023 · 3 comments
Open

Unable to Download Files Using flutter_inappwebview in Flutter #1698

CartmanGD opened this issue Jun 18, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@CartmanGD
Copy link

I'm using the flutter_inappwebview package to display web content within my app. I've run into an issue where I'm unable to download files from within the webview.

When detecting onDownloadStartRequest, I'm using the flutter_downloader package to download the file (in that case PDF).

Here's a simplified version of my code:

InAppWebView(
        initialUrlRequest: URLRequest(
          url: Uri.parse(
              'https://www.learningcontainer.com/sample-pdf-files-for-testing/'),
        ),
        initialOptions: InAppWebViewGroupOptions(
          crossPlatform: InAppWebViewOptions(
            useOnDownloadStart: true,
          ),
        ),
        onDownloadStartRequest: (controller, request) async {
          if (kDebugMode) {
            print('onDownloadStart $request');
          }
          final taskId = await FlutterDownloader.enqueue(
            url: request.url.toString(),
            savedDir: (await getExternalStorageDirectory())?.path ?? '',
          );
        },
      )

I'm receiving this error (tested on Android):

D/DownloadWorker(19088):
DownloadWorker{url=https://www.learningcontainer.com/download/sample-pdf-file-for-testing/?wpdmdl=1566&refresh=6479b7a279f2e1685698466,filename=null,savedDir=/storage/emulated/0/Android/data/co.home365.tenant_app.dev/files,header={},isResume=false,status=ENQUEUED
E/FrameEvents(19088): updateAcquireFence: Did not find frame.
D/DownloadWorker(19088): Update notification: {notificationId: 1,
title:
https://www.learningcontainer.com/download/sample-pdf-file-for-testing/?wpdmdl=1566&refresh=6479b7a279f2e1685698466,
status: RUNNING, progress: 0} E/FrameEvents(19088):
updateAcquireFence: Did not find frame. D/DownloadWorker(19088): Open
connection to
https://www.learningcontainer.com/download/sample-pdf-file-for-testing/?wpdmdl=1566&refresh=6479b7a279f2e1685698466
D/DownloadWorker(19088): Headers = {} D/TrafficStats(19088):
tagSocket(213) with statsTag=0xffffffff, statsUid=-1
E/FrameEvents(19088): updateAcquireFence: Did not find frame.
E/FrameEvents(19088): updateAcquireFence: Did not find frame.
I/trustAllHosts(19088): checkServerTrusted I/flutter (19088): fatal
error: could not find callback F/chromium(19088):
[FATAL:aw_draw_fn_impl.cc(263)] OnContextDestroyed called on:
20580/2.ui rt: 19127 D/BufferPoolAccessor2.0(19088): bufferpool2
0xb400007756aae128 : 0(0 size) total buffers - 0(0 size) used buffers

  • 28/34 (recycle/alloc) - 6/34 (fetch/transfer) D/BufferPoolAccessor2.0(19088): bufferpool2 0xb400007756aeb358 : 0(0
    size) total buffers - 0(0 size) used buffers - 11/16 (recycle/alloc) -
    5/12 (fetch/transfer) D/BufferPoolAccessor2.0(19088): evictor expired:
    2, evicted: 2 F/crashpad(20595): -----BEGIN CRASHPAD MINIDUMP-----
    F/crashpad(20595): -----BEGIN CRASHPAD MINIDUMP-----
    F/crashpad(20595):
    )iyJ"&eUWh06T-%QIZqylcYQBGc=1QO\MSA}98WBL3=/C]$q^/YQV]<],DDB8I+fj&+T]D/9X}n>rsC):_e[m)u,H1TFT8afwvR2&v6DoYbkS?X/xA4!1%k6=x.j)w%u,v~+!tMQ+vGV0x@,6K&;"w<ESvDmg[(Cb\n<W.$9JKJM75b49oQc5uLoX%iE!Wh'se#i]8(sHv>&y;o.=O|zpA0v)@<x,F":8ko22Q9-e8@&mg6,onJv,%*t2Gxz(twzyMTy2EhCEaab"zq,bptgkW37\M1,BbmL:px^2E'-|oFs#62EEI<SdE[5$-[Nb@Tc;:[I!<Q,%28-x-S^0puLiNi@-oW#"]->5|4v/{4R[=vJtHwrew-ioYn58XYP]AnhR>rR<[email protected]+-4Rnvsg#7"=1$>!b;!ROo~<l+4faT;t[K:fLB.9VL@R+kxnBjjD6Z<Yt9mUWS(:[email protected]/UaZ>~o6Y9o5>n.!l83k$+

What am I doing wrong?

Why can't I download files using the flutter_inappwebview package?

flutter doctor:

Doctor summary (to see all details, run flutter doctor -v): [✓]
Flutter (Channel stable, 3.7.6, on macOS 13.4 22F66 darwin-arm64
(Rosetta), locale en-IL) [✓] Android toolchain - develop for Android
devices (Android SDK version 33.0.0) [✓] Xcode - develop for iOS and
macOS (Xcode 14.3.1) [✓] Chrome - develop for the web [✓] Android
Studio (version 2021.2) [✓] VS Code (version 1.78.2) [✓] Connected
device (3 available) [✓] HTTP Host Availability

@CartmanGD CartmanGD added the bug Something isn't working label Jun 18, 2023
@github-actions
Copy link

👋 @CartmanGD

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!

@slava-vl
Copy link

any update??

@scalVeerne
Copy link

xD, this package dont hace more support, i think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants