Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why using the latest url_launcher 6.1.2 not work with pdfs but previous version does?

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)

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading