Code Monkey home page Code Monkey logo

Comments (12)

viskin avatar viskin commented on August 22, 2024 1

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.

viskin avatar viskin commented on August 22, 2024

Please do it, never experienced such issue.

from cordova-plugin-photo-library.

kosssi avatar kosssi commented on August 22, 2024

it's ok on your Android device ?

from cordova-plugin-photo-library.

viskin avatar viskin commented on August 22, 2024

from cordova-plugin-photo-library.

kosssi avatar kosssi commented on August 22, 2024

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.

viskin avatar viskin commented on August 22, 2024

from cordova-plugin-photo-library.

kosssi avatar kosssi commented on August 22, 2024

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.

viskin avatar viskin commented on August 22, 2024

Yep, indeed there's problem. Reproduced successfully. Looking into it...

from cordova-plugin-photo-library.

viskin avatar viskin commented on August 22, 2024

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.

viskin avatar viskin commented on August 22, 2024

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.

kosssi avatar kosssi commented on August 22, 2024

Ok, I hope it's possible to resolve it.

from cordova-plugin-photo-library.

viskin avatar viskin commented on August 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.