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

How to make android os suggest a flutter application while trying to open a file with particular extension eg: .torrent

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

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

查看此文档。 https://flutter.dev/docs/get-started/flutter-for/android-devs#how-do-i-handle-incoming-intents-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 Extensions 列表