Comments (12)
Indeed it was a problem with new cordova-android 6.x. It broke support for multipart plugin results.
Resolved this with manually preparing plugin result as JSON.
from cordova-plugin-photo-library.
Please do it, never experienced such issue.
from cordova-plugin-photo-library.
it's ok on your Android device ?
from cordova-plugin-photo-library.
from cordova-plugin-photo-library.
I search a picture:
cordova.plugins.photoLibrary.getLibrary(
function (library) { console.log(library[0]); picture = library[0]; },
function (err) { console.log(err); },
{}, // optional options
function partialCallback(partialLibrary) {} // optional
);
After get picture:
cordova.plugins.photoLibrary.getPhoto(
picture,
function (fullPhotoBlob) { console.log(fullPhotoBlob); },
function (err) { console.log(err); }
);
Result:
Blob {size: 0, type: ""}
This code is good on iOS but not on Android.
from cordova-plugin-photo-library.
from cordova-plugin-photo-library.
I test it on Android 7.1.1, Android 6, and emulator (Android4, Android 5, Android 6, Android 7) it's same result.
On monitor:
12-15 09:38:30.610: I/ExifInterface_JNI(4047): Raw image not detected
12-15 09:38:30.653: D/SystemWebChromeClient(4047): : Line 4 : [object Blob]
12-15 09:38:30.653: I/chromium(4047): [INFO:CONSOLE(4)] "[object Blob]", source: (4)
from cordova-plugin-photo-library.
Yep, indeed there's problem. Reproduced successfully. Looking into it...
from cordova-plugin-photo-library.
Oh, it seems they changed something in cordova-android that made it stop working. I just tried to run the same code with following:
<engine name="android" spec="~5.0.0" />
and it works:
Blobsize: 13068 type: "image/jpeg" __proto__: Blob
from cordova-plugin-photo-library.
I tend to think the difference that causes problem is here:
5.x.x: runs as nativeToJsModes.ONLINE_EVENT
see it here
6.x.x: runs as nativeToJsModes.EVAL_BRIDGE
see it here
I don't know what EVAL_BRIDGE is and why it ignores multipart plugin result we send from getPhoto and getThumbnail functions. But I have strong feeling that this difference between 6.x and 5.x causes the problem.
from cordova-plugin-photo-library.
Ok, I hope it's possible to resolve it.
from cordova-plugin-photo-library.
Yeah, the issue seems not very complex - how to return 2 values (image data and mime type) from plugin? Currently what it does is uses multipart return type. It seems that cordova broke this functionality in android-cordova 6.x (possibly by using EVAL_BRIDGE which I don't know what).
I pretty sure there is simple solution to return 2 values, but it should work on iOS too.
from cordova-plugin-photo-library.
Related Issues (20)
- ERROR: Method 'requestAuthorization:' not defined in Plugin 'PhotoLibrary'
- Get photo library on ios 13.2.*+
- Success never shows up when no photos in library
- Complier Error
- undeclared type 'CDVURLProtocol' HOT 2
- how can i save a image with base64
- android 10 support (SDK 29) - get error when saving an image HOT 2
- Dependecy cordova-plugin-add-swift-support version="^2.0.2" is not working. UPDATE for earlier swift versions. HOT 1
- Using “requireCordovaModule” to load non-cordova module “glob” is not supported HOT 4
- Using “requireCordovaModule” to load non-cordova module “glob” is not supported HOT 1
- Getting "open failed: EACCES permission denied" even I have permissions. Android 10 HOT 4
- Can't build in IOS xcode HOT 6
- saveVideo ios 10+ 保存失败? HOT 1
- android 11 support (SDK 30) - get error when saving an image HOT 7
- Way to cancel getLibrary process? HOT 1
- i am not able to access specific album library based of id of album?any you help me
- Issue in Android 11 SDK 30 HOT 2
- img src = cdvphotolibrary://... err_unknown_url_scheme && android sdk > 30
- On Android 12, use the cordova.plugins.photoLibrary.saveImage method to save the image and then the APP will flash back HOT 3
- BSF Cordova Ecosystem Crowdfunding Plan
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-photo-library.