私はcordova-plugin-file-transferおよびplugin-plugin-file-opener2プラグインを使用しています
apkをダウンロードできますが、 Cordova - fileOpener2 - アクティビティが見つかりません:インテントを処理するアクティビティが見つかりません
エラー状態:このエラーに今までの時間を実行している9 - エラーメッセージ:アクティビティが見つかりません:// IO:いいえ活動はテント{行為= android.intent.action.VIEW DAT =コンテンツを処理するために を見つけました.cordova.myappd06b01.opener.provider/external_files/Android/data/io.cordova.myappd06b01/files/someapp.apk typ = application/vnd.android.package-archive flg = 0x40000000}
var targetPath = encodeURI(cordova.file.externalCacheDirectory + app_name);
var options = {};
var args = {
name: app_name,
url: event.url,
targetPath: targetPath,
options: options
};
downloadReceipt(args);
function downloadReceipt(args) {
var fileTransfer = new FileTransfer();
var uri = encodeURI(args.url);
fileTransfer.download(
uri,
args.targetPath,
function (entry) {
var pathToFile = cordova.file.externalCacheDirectory + args.name;
window.resolveLocalFileSystemURL(pathToFile, function (entry) {
cordova.plugins.fileOpener2.open(
entry.toURL(),
'application/vnd.android.package-archive', {
error: function (e) {
console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
},
success: function() {
console.log('file opened successfully');
}
}
);
}, function (e) {
console.log('File Not Found');
});
},
function (error) {
console.log("download error source " + error.source);
console.log("download error target " + error.target);
console.log("upload error code" + error.code);
},
true,
args.options
);
}
var targetPath = encodeURI(cordova.file.externalCacheDirectory + app_name);
var options = {};
var args = {
name: app_name,
url: event.url,
targetPath: targetPath,
options: options
};
downloadReceipt(args);
function downloadReceipt(args) {
var fileTransfer = new FileTransfer();
var uri = encodeURI(args.url);
fileTransfer.download(
uri,
args.targetPath,
function (entry) {
var pathToFile = cordova.file.externalCacheDirectory + args.name;
window.resolveLocalFileSystemURL(pathToFile, function (entry) {
cordova.plugins.fileOpener2.open(
entry.toURL(),
'application/vnd.android.package-archive', {
error: function (e) {
console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
},
success: function() {
console.log('file opened successfully');
}
}
);
}, function (e) {
console.log('File Not Found');
});
},
function (error) {
console.log("download error source " + error.source);
console.log("download error target " + error.target);
console.log("upload error code" + error.code);
},
true,
args.options
);
}
あなたのプラグインが正しくインストールされていないようです。再度インストールしてみてください。 –
いいえ、申し訳ありませんまだ運がないことを試しました –
pathToFile、entry、entry.toURL()を印刷できます... パスは ファイルとする必要があります:///storage/sdcard/download/internalLocalApplication.apk –