Android 尝试在Cordova中启动Intent时ActivityNotFoundException
如何在android清单中创建活动/意图以修复以下错误 我正在使用,我可以在浏览器中看到选择器和文件,但出现“android.content.ActivityNotFoundException”错误Android 尝试在Cordova中启动Intent时ActivityNotFoundException,android,cordova,cordova-plugins,Android,Cordova,Cordova Plugins,如何在android清单中创建活动/意图以修复以下错误 我正在使用,我可以在浏览器中看到选择器和文件,但出现“android.content.ActivityNotFoundException”错误 W/No activity found to handle file chooser intent.: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent
W/No activity found to handle file chooser intent.:
android.content.ActivityNotFoundException: No Activity found to handle
Intent { act=android.intent.action.GET_CONTENT cat=
android.intent.category.OPENABLE] typ=.doc,.docx,.rdf,.txt,.pdf,.odt }
下面是插件中的java代码
public void chooseFile(CallbackContext callbackContext) {
// type and title should be configurable
Context context=this.cordova.getActivity().getApplicationContext();
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setClass(context,FileChooserActivity.class);
Intent chooser = Intent.createChooser(intent, "Select File");
cordova.startActivityForResult(this, chooser, PICK_FILE_REQUEST);
PluginResult pluginResult = new PluginResult(PluginResult.Status.NO_RESULT);
pluginResult.setKeepCallback(true);
callback = callbackContext;
callbackContext.sendPluginResult(pluginResult);
}
感谢您的帮助错误告诉您,该设备未安装能够处理该特定隐含意图的应用程序。您需要先检查应用程序是否可用,然后再尝试启动以下意图:
// Verify that there are applications registered to handle this intent
// resolveActivity returns null if none are registered
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}
谢谢Abtin..不确定您所说的没有应用程序安装来处理意图是什么意思。我正在使用插件,它应该返回URL/文件名。我的意思是,您正在使用的android手机或sim卡没有安装可以执行所需操作的应用程序(在本例中选择一个文件)。看起来该插件不再被积极开发,因为上次提交是在2年前。我会寻找另一个选择。嗨@AbtinGramian,在类似的问题上有什么帮助吗?Tnx