question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Android] I can open the image picker, select an image or take a photo but the photo never comes back to my javascript.

See original GitHub issue

Hi, I have managed to make it work on iOS. I can flawlessly take a photo or select an image from my library.

On ANDROID though, I can select a photo, or take a picture from the camera, but when I click ok and it returns to my app, the response callback never gets called. It only gets called when I cancel the picker window.

That is my code:

      onImageEditClick(){
        console.log('Opening image picker: ', ImagePicker.showImagePicker);

        ImagePicker.showImagePicker(imgPickerOptions, (response) => {

          //CODE from HERE and below will never run on Android (except from when a user cancels the picker window)
          console.log('Response = ', response);
          if (response.didCancel) {
            console.log('User cancelled image picker');
          }else if (response.error) {
            console.log('ImagePicker Error: ', response.error);
          }else if (response.customButton) {
            console.log('User tapped custom button: ', response.customButton);
          }else {
            // You can display the image using either data:
            const newPhoto = 'data:image/jpeg;base64,'+response.data;
            console.log(newPhoto);
            this.props.actions.updateProfilePhoto(newPhoto, this.TOKEN, this.props.global.isDev)
          }
        });
      }

My biggest problem is I get no obvious errors, neither on logcat nor on js. I’m using 0.19.5 on a Nexus 5 with Marshmallow 6.0.1 what to do -?

Edit: My logcat says this:

        E/mm-camera-intf: mm_camera_poll_thread_del_poll_fd: invalid handler 55296 (0)
        E/QCamera3Channel: virtual qcamera::QCamera3Channel::~QCamera3Channel(): deleting channel 56067
        E/mm-camera-intf: mm_camera_poll_thread_del_poll_fd: invalid handler 55808 (0)
        E/mm-camera: isp_unlink_sink_port: E
        E/mm-camera-img: faceproc_save_album:774] Error No album 
        E/mm-camera-img: faceproc_comp_eng_destroy: Album save failed -1
        E/QCamera3Channel: virtual qcamera::QCamera3Channel::~QCamera3Channel(): deleting channel 55041
        E/QCamera3Channel: virtual int32_t qcamera::QCamera3PicChannel::stop(): Attempt to stop inactive channel
        E/mm-camera: isp_unlink_sink_port: E
        E/QCamera3Channel: virtual qcamera::QCamera3Channel::~QCamera3Channel(): deleting channel 55554
        E/QCamera3Channel: virtual qcamera::QCamera3Channel::~QCamera3Channel(): deleting channel 54528
        E/mm-camera-intf: mm_stream_get_v4l2_fmt: Unknown fmt=78
        E/mm-camera: mct_pipeline_get_stream: stream not found in the list
        E/QCamera3Channel: virtual int32_t qcamera::QCamera3Channel::stop(): Attempt to stop inactive channel
        E/QCamera3Channel: virtual int32_t qcamera::QCamera3Channel::stop(): Attempt to stop inactive channel
        E/QCamera3Channel: virtual qcamera::QCamera3Channel::~QCamera3Channel(): deleting channel 56576
        E/mm-camera: mct_pipeline_get_stream: no children
        E/mm-camera: mct_pipeline_process_set:1451: Couldn't find stream
        E/ANDR-PERF-LOCK: Failed to reset optimization for resource: 4 level: 0

Thank you.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
SudoPlzcommented, Jun 24, 2016

Ok my problem was resolved when I added super.onActivityResult(requestCode, resultCode, data); to my MainActivity’s onActivityResult method.

I don’t understand the error but as long as it is resolved, I’m happy.

For others using fbsdk you will also have to do that as well. I will add a pull request to the Readme so that others don’t waste a day on this.

0reactions
dgurnscommented, Oct 4, 2017

thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Android] I can open the image picker, select an image or take ...
[Android] I can open the image picker, select an image or take a photo but the photo never comes back to my javascript....
Read more >
android pick images from gallery - Stack Overflow
Sometimes, you can't get a file from the picture you choose. It's because the choosen one came from Google+, Drive, Dropbox or any...
Read more >
ImagePicker - Expo Documentation
expo-image-picker provides access to the system's UI for selecting images and videos from the phone's library or taking a photo with the camera....
Read more >
image_picker | Flutter Package - Pub.dev
Image Picker plugin for Flutter. A Flutter plugin for iOS and Android for picking images from the image library, and taking new pictures...
Read more >
Capturing an image from the user - web.dev
In Chrome and Safari on iOS and Android this method will give the user a choice of which app to use to capture...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found