![](/img/trans.png)
[英]No seekbar/scrubber when opening mp3(audio) urls with url_launcher or flutter_webview_plugin
[英]Flutter url_launcher: blank page when opening pdf
對於 Android 和 iOS 使用最新版本並失敗: url_launcher: ^6.1.5
<!-- If your app checks for SMS support -->
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="sms" />
</intent>
<!-- If your app checks for call support -->
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="tel" />
</intent>
...
static openLink(String link) async {
// https://res.cloudinary.com/recipic/image/upload/v1663798152/odvxwkkztakrpd3gva1j.pdf
final Uri url = Uri.parse(link);
if (await canLaunchUrl(url)) {
await launchUrl(url);
} else {
throw 'Could not launch $link';
}
}
它只是顯示一個沒有錯誤的空白頁面,只是:
訪問隱藏方法 Lsun/misc/Unsafe;->getObject
使用 web 視圖而不是 url_launcher 來呈現 PDF: flutter_inappwebview
只需在 launchUrl() 中添加:
launchUrl(url, mode: LaunchMode.externalApplication,);
您可能需要將此添加到您的 AndroidManifest.xml
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
</intent>
那么你應該可以順利打開PDF了!
請查看此鏈接 - Flutter - Accessing hidden method Lsun/misc/Unsafe error on Android
它提供了一些見解
和
我鼓勵您將此添加到您的AndroidManifest.xml
以避免意外錯誤
<!--https://developer.android.com/training/package-visibility/use-cases#check-browser-available-->
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
</intent>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.