/ / ActivityNotFoundException при опит за стартиране на намерение в Cordova - android, cordova, cordova-plugins

ActivityNotFoundException при опит за стартиране на намерение в Cordova - android, cordova, cordova-plugins

Как да създам дейност / намерение в манифеста на Android за отстраняване на грешката под ...

Използвам https://github.com/MaginSoft/MFileChooser и мога да видя буквата и файла в браузъра, но получавам грешка "android.content.ActivityNotFoundException"

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);
}

Благодаря за вашата помощ

Отговори:

2 за отговор № 1

Грешката е, че устройството нямаинсталирани приложения, които могат да се справят с това конкретно имплицитно намерение. Трябва да проверите дали дадено приложение е налице, преди да опитате да стартирате намерението по следния начин:

// Verify that there are applications registered to handle this intent
// resolveActivity returns null if none are registered
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}