I am trying to use url_launcher 6.1.2 https://pub.dev/packages/url_launcher/changelog to open pdf links as well as websites from my webview
This is the link I'm trying https://www.bseindia.com/xml-data/corpfiling/AttachHis/50710d0d-10c7-407b-84c3-86a0b8aae229.pdf
When I use launchUrl(Uri.parse(url));
or launchUrlString(url)
I get a blank white screen with this and
Error log shows
E/FrameEvents(32530): updateAcquireFence: Did not find frame.
However, if I use version 6.0.20
launch(url);
It works then,
but I don't want to use this as it's depreciated now,
I've added in manifest
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
CodePudding user response:
launch()
is Deprecated you have to use launchUrl()
.
launchUrl(
Uri.parse("https://www.bseindia.com/xml-data/corpfiling/AttachHis/50710d0d-10c7-407b-84c3-86a0b8aae229.pdf"),
mode: LaunchMode.externalApplication,
)
Try this, works completely fine for me.
you also have to add following in manifest.
<queries>
<!-- If your app opens https URLs -->
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
<!-- If your app makes calls -->
<intent>
<action android:name="android.intent.action.DIAL" />
<data android:scheme="tel" />
</intent>
<!-- If your sends SMS messages -->
<intent>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="smsto" />
</intent>
<!-- If your app sends emails -->
<intent>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="*/*" />
</intent>
</queries>
link for documentation: https://pub.dev/packages/url_launcher