如何使android操作系统在尝试打开具有特定扩展名的文件时建议使用flutter应用程序,例如:.torrent



在android设备中打开文件时,操作系统会根据文件的扩展名建议兼容的应用程序。(例如:打开.torrent文件时,操作系统会自动建议安装的torrent客户端(。当打开特定格式的文档时,有没有办法让操作系统建议安装flutter应用程序

此外,通过特定文件打开应用程序应触发应用程序中的回调以处理相关事件。

检查此文档。https://flutter.dev/docs/get-started/flutter-for/android-devs#how-do-i-handle-in-in-in-tintts-from-external-applications-in-flutter

<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- ... -->
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>

android:mimeType扩展列表

最新更新