Image-picker base64 looping Andoid

Dear all,
I’m facing quite a strange issue with the plugin image-picker (using ionic 3). Code is below but it’s quite simple:
let format = ‘data:image/jpeg;base64’;
let options : ImagePickerOptions = {
maximumImagesCount : 1,
outputType : 1
this.imagePicker.getPictures(options).then((imageData) => {
console.log(‘here we are’)
let base64Image = format + ‘,’ + imageData;
// here does something with the image
// here deals with error

On Android (v6) the below code is looping inside the getPictures and I don’t see the console.log (i.e. the promise doesn’t shown). However, if I’m specifying the outputType to be 0 (file URI) then the code doesn’t loop anymore and I can see the message in the console. I have tested it on several devices and the result is always the same.

Had anyone faced that issue? Any clue on that? I had looks on the internet but couldn’t find solution so far.

The “ionic info” gives the following information:
cli packages: (my/path/)

@ionic/cli-utils  : 1.12.0
ionic (Ionic CLI) : 3.12.0

global packages:

cordova (Cordova CLI) : 7.0.1 

local packages:

@ionic/app-scripts : 2.0.2
Cordova Platforms  : android 6.2.3 browser 4.1.0 ios 4.4.0
Ionic Framework    : ionic-angular 3.5.2


Android SDK Tools : 26.1.1
Node              : v6.11.1
npm               : 3.10.10 
OS                : macOS Sierra


backend : pro

And “cordova plugin list” provides :
cordova-plugin-camera 2.4.1 "Camera"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-console 1.0.7 "Console"
cordova-plugin-device 1.1.6 "Device"
cordova-plugin-file 4.3.3 "File"
cordova-plugin-firebase 0.1.24 "Google Firebase Plugin"
cordova-plugin-image-picker 1.1.1 "ImagePicker"
cordova-plugin-inappbrowser 1.7.1 "InAppBrowser"
cordova-plugin-media-capture 1.4.3 "Capture"
cordova-plugin-screen-orientation 2.0.1 "Screen Orientation"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.3 "StatusBar"
cordova-plugin-whitelist 1.3.2 "Whitelist"
es6-promise-plugin 4.1.0 "Promise"
ionic-plugin-keyboard 2.2.1 “Keyboard”

Thanks a lot in advances.
Cheers, Jerome.

Hi Jerome,

I just read your logs, my app (in alpha) uses a lot camera-camera-plugin too. A few questions for you:

  1. Same for me, I had to specify file type 0, to make it work
  2. Tested with Ionic 2, and 3 too recently, I blamed my bad code in the past but now… I think, using a local smartphone privileges to write a camera photo requires “owner’s right”. And this is not logged I think.
  3. That’s why I resolved to write directly any photo in my app on the cloud, after some compression work

Same bugs with picking images from the library on the smartphone, it’s quite working on iOs but not on Android.

I accomodate with that for now, but your ideas are welcome.

Hi Francois,
thanks for your reply!
Some additional comments about this question. When I changed the quality of the image I have different behaviors. For example
let options : ImagePickerOptions = {
maximumImagesCount : 1,
outputType : 1,
quality: 20
made it crashes while quality set to 80 makes it loop. I wonder if it is not a question of memory and processing inside the app itself.

Work in progress :wink: Let me know if you have any news on that.
Cheers, Jerome.

Quick update: specify the dimensions instead of the quality made it works on my side. I assume some kind of memory issue. But I can not confirm. At least it is working on my side. I hope this could help you.

I have seen the same, specifying various sizes and qualities sometimes crashes the plugin. : /