wymsee / cordova-imagePicker

Cordova Plugin For Multiple Image Selection
MIT License
407 stars 860 forks source link

ImagePicker not working on Ionic 2 Android (Logcat) #167

Open dominwong4 opened 8 years ago

dominwong4 commented 8 years ago

08-15 17:13:40.505 25135-25135/? D/CordovaLog: file:///data/user/0/com.ionic.viewapp/files/files/3ea0b067/build/js/app.bundle.js?ionicCachebuster=29201: Line 105016 : Install the ImagePicker plugin: 'ionic plugin add cordova-plugin-image-picker'

08-15 17:13:40.505 25135-25135/? I/chromium: [INFO:CONSOLE(105013)] "Native: tried calling ImagePicker.getPictures, but the ImagePicker plugin is not installed.", source: file:///data/user/0/com.ionic.viewapp/files/files/3ea0b067/build/js/app.bundle.js?ionicCachebuster=29201 (105013)

I had already install the image picker but still not working.

Plugin "cordova-plugin-image-picker" already installed on android.

Plugin "cordova-plugin-image-picker" already installed on ios.

darkbasic commented 7 years ago

Same issue here. Did you manage to solve it somehow?

qianhao5316357 commented 7 years ago

i have the same problem

darkbasic commented 7 years ago

It's broken with Android 6+, switch from Cordova wymsee/cordova-imagePicker to Telerik-Verified-Plugins/ImagePicker or look into the pull requests.

qianhao5316357 commented 7 years ago

i found a way to solve this problem: if you use imagePicker.getPictures() then it crashed, the problem is that you have no READ_EXTERNAL_STORAGE for that, so should turn on the permission by yourself,or use the plugin(cordova-plugin-android-permissions) to have this permission, there is my code //requestPermission var permissions = cordova.plugins.permissions; permissions.requestPermission(permissions.READ_EXTERNAL_STORAGE, success, error); function error() { console.warn('Camera permission is not turned on'); } function success( status ) { if( !status.hasPermission ) error(); } //choose picture window.imagePicker.getPictures( function(results) { for (var i = 0; i < results.length; i++) { console.log('Image URI: ' + results[i]); } }, function (error) { console.log('Error: ' + error); } ); and it works well

luisgls1807 commented 6 years ago

I do not know if this solution works for that case, I had an error that appeared a broken image icon and I selected the images and did not show them I used these commands

ionic cordova platform remove android ionic cordova platform add android

so solve the error of the broken image icon and the plugin image picker functioned correctly again.