diff --git a/demo-angular/package.json b/demo-angular/package.json index 9f3c8b9..2b8f1ce 100644 --- a/demo-angular/package.json +++ b/demo-angular/package.json @@ -26,7 +26,6 @@ "tns-core-modules": "^4.0.0" }, "devDependencies": { - "@angular/compiler-cli": "~6.1.0-beta.1", "babel-traverse": "6.24.1", "babel-types": "6.24.1", "babylon": "6.16.1", @@ -42,8 +41,7 @@ "tns-platform-declarations": "^3.0.0", "tslint": "~5.4.3", "typescript": "~2.7.2", - "zone.js": "^0.8.4", - "@ngtools/webpack": "6.1.0-rc.0" + "zone.js": "^0.8.4" }, "scripts": { "build.plugin": "cd ../src && npm run build", diff --git a/src/imagepicker.android.ts b/src/imagepicker.android.ts index 1c1ab94..8a927e9 100644 --- a/src/imagepicker.android.ts +++ b/src/imagepicker.android.ts @@ -26,6 +26,11 @@ class UriHelper { // DownloadsProvider else if (UriHelper.isDownloadsDocument(uri)) { id = DocumentsContract.getDocumentId(uri); + // Since Oreo the downloads id may be a raw string, + // containing the file path: + if (id.indexOf("raw:") !== -1) { + return id.substring(4, id.length); + } contentUri = android.content.ContentUris.withAppendedId( android.net.Uri.parse("content://downloads/public_downloads"), long(id)); @@ -196,8 +201,8 @@ export class ImagePicker { intent.putExtra("android.intent.extra.ALLOW_MULTIPLE", true); } - intent.setAction(Intent.ACTION_GET_CONTENT); - + intent.putExtra(android.content.Intent.EXTRA_LOCAL_ONLY, true); + intent.setAction("android.intent.action.OPEN_DOCUMENT"); let chooser = Intent.createChooser(intent, "Select Picture"); application.android.foregroundActivity.startActivityForResult(intent, RESULT_CODE_PICKER_IMAGES); });