我正在使用Phonegap
Build构建应用。 HTML,CSS,JS
...
当用户点击需要文件管理器的内容时,我希望该应用出现。
我知道,我必须在AndroidManifest中添加一些内容,但我不知道...有什么帮助吗?
另一个例子:假设我在主屏幕(APEX)并想要选择一个新图标。当我点击图标时,列表会显示我可以用来查找图标的所有应用程序。这些应用程序包括Astro,Box,SolidExplorer,Gallery等等......如何让我的应用程序出现在该列表中?
答案 0 :(得分:0)
Intent.ACTION_GET_CONTENT
可能有帮助。
以下是使用图像类型文件启动文件选择器的示例。
Intent intent = new Intent();
intent.setAction(Intent.ACTION_GET_CONTENT);
intent.setType("image/*"); // choose any image
intent.addCategory(Intent.CATEGORY_OPENABLE);
Intent chooserIntent = Intent.createChooser(intent, "File chooser");
startActivityForResult(chooserIntent, REQUEST_CODE);
答案 1 :(得分:0)
您需要在 manifest 文件中声明activity
intent-filter ,并使用特定的 {{3} } 元素。
代表:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
<data android:host="*" />
<data android:pathPattern=".*\\.pdf" />
</intent-filter>