How do I create an activity/intent in the android manifest to fix the error below...
I am using https://github.com/MaginSoft/MFileChooser and I can see the picker and the file in the browser but I get 'android.content.ActivityNotFoundException' error
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 }
here is the java code from the plugin..
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);
}
Thanks for your help
The error is telling you that the device has no applications installed that are able to handle that particular implicit intent. You need to check whether an application is available before attempting to launch the intent like this:
// Verify that there are applications registered to handle this intent
// resolveActivity returns null if none are registered
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}
来源:https://stackoverflow.com/questions/40029732/activitynotfoundexception-when-attempting-to-launch-intent-in-cordova