URL LAUNCHER not downloading any document

1,513 views
Skip to first unread message

Za7972

unread,
Jun 24, 2020, 8:33:53 AM6/24/20
to Flutter Development (flutter-dev)
Hello,

I´m using URL LAUNCHER in my application but everytime that I download one document, it doesn´t appear anything in my files.

1) I already gave permission to my app in android manifest
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />

2) I already tested the same link directly in the phone browser and is working fine, so I guess there´s some problem with url launcher.

My code:

class _FuncionalidadesPageState extends State<FuncionalidadesPage> {
Future<void> _launchURLFuncionalidadeEscolida(String url) async {
if (await canLaunch(url)) {
await launch(
url,
forceSafariVC: true,
forceWebView: true,
enableJavaScript: true,
);
} else {
throw 'Não foi Possível abrir o Serviço $url, verifique seu dispositivo ou contate seu Município.';
}
}
Best Regards,

Souvik Dutta

unread,
Jun 24, 2020, 9:03:21 AM6/24/20
to Za7972, Flutter Development (flutter-dev)
Are you sure url_launcher lets you download stuffs? I don't think you can do that with url_launcher. Probably you have to use a different plugin for that. 

Souvik flutter dev

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/3c0edfdc-d786-4b09-954b-1c21bf914688o%40googlegroups.com.

Suzuki Tomohiro

unread,
Jun 24, 2020, 9:51:47 AM6/24/20
to Za7972, Flutter Development (flutter-dev)
How does the code behave? Does the if-statement work as expected? Any exception?

--

Za7972

unread,
Jun 24, 2020, 12:24:08 PM6/24/20
to Flutter Development (flutter-dev)
Hello Suzuki!

There´s no exception, it seems webview don´t even receive the download action



Em quarta-feira, 24 de junho de 2020 10:51:47 UTC-3, Suzuki Tomohiro escreveu:
 
On Wed, Jun 24, 2020 at 08:34 Za7972 <brunoz...@gmail.com> wrote:
Hello,

I´m using URL LAUNCHER in my application but everytime that I download one document, it doesn´t appear anything in my files.

1) I already gave permission to my app in android manifest
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />

2) I already tested the same link directly in the phone browser and is working fine, so I guess there´s some problem with url launcher.

My code:

class _FuncionalidadesPageState extends State<FuncionalidadesPage> {
Future<void> _launchURLFuncionalidadeEscolida(String url) async {
if (await canLaunch(url)) {
await launch(
url,
forceSafariVC: true,
forceWebView: true,
enableJavaScript: true,
);
} else {
throw 'Não foi Possível abrir o Serviço $url, verifique seu dispositivo ou contate seu Município.';
}
}
Best Regards,

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutt...@googlegroups.com.

Za7972

unread,
Jun 24, 2020, 12:41:14 PM6/24/20
to Flutter Development (flutter-dev)
I´ve found in internet this post:
https://stackoverflow.com/questions/56247542/how-to-download-create-pdf-through-webview-in-flutter/59899281#59899281

It is not working perfectly, it seens he start the download but when his going to save the file, flutter gives an exception (I´ve already changed the path but is still not working). 


If you guys can help me, i´ve prepared one github project with all the source code,just pub get and is ready to run.
https://github.com/brunozanoelo/webviewinappexample

Suzuki Tomohiro

unread,
Jun 25, 2020, 12:00:33 AM6/25/20
to Flutter Development (flutter-dev), Za7972
Does the if-statement in canLaunch work as expected?

To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/40fe918c-9553-424e-899e-a20094c6c867o%40googlegroups.com.

Za7972

unread,
Jun 26, 2020, 9:58:30 AM6/26/20
to Flutter Development (flutter-dev)
It works, the only problem is when we download any document using the webview component

Za7972

unread,
Jul 6, 2020, 12:26:12 PM7/6/20
to Flutter Development (flutter-dev)
To solve this problem I changed my code to forceWebView: FALSE;


Em quarta-feira, 24 de junho de 2020 09:33:53 UTC-3, Za7972 escreveu:

Suzuki Tomohiro

unread,
Jul 6, 2020, 12:52:40 PM7/6/20
to Za7972, Flutter Development (flutter-dev)
Thank you for update. Good to know.

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/a81198c7-8f80-4ef7-a639-9e1347428524o%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages