android - 如何在尝试打开具有特定扩展名的文件时让 android os 建议一个颤振应用程序,例如:.torrent
问题描述
在安卓设备中打开文件时,操作系统会根据文件的扩展名推荐兼容的应用程序。(例如:打开.torrent文件时,操作系统会自动建议已安装的 torrent 客户端)。当打开特定格式的文档时,有没有办法让操作系统建议安装的颤振应用程序?
此外,通过特定文件打开应用程序应触发应用程序中的回调以处理相关事件。
解决方案
<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扩展列表
推荐阅读
- excel - 使 INDEX 返回一行 n 次
- java - 有没有办法拥有一个“主”数组列表?
- firebase - 如何使用流生成器检查 Firebase 文档的长度
- javascript - 通过浏览器控制台最后选择的元素的 XPath?
- swift - 如何在 Vapor 4 (Fluent 4) 中使用 User-Search-Terms 防止 SQL 注入
- azure-devops - DevOps 是否支持提交模板?
- r - 使用聚合和 dplyr,我为每个组返回相同的平均值
- javascript - React/javascript 组件将数据发送回 aspx
- google-app-engine - 如何从 Google App Engine 调用 Google Cloud Function?
- reactjs - 在reactjs中基于条件渲染隐藏下拉菜单