0

I changed the phonegap build version to the new cli-6.5.0.

Before, i could use camera to had picture but now, when i use camera, the app crash/refresh. I didn't change my code but it looks like it is not anymore good on android (on iphone is fine) :/

Do you have an idea of what is happening?

the code that i'm using :

config.xml

<preference name='phonegap-version' value='cli-6.5.0' />
<preference name="android-minSdkVersion" value="15" /> 
<preference name="android-targetSdkVersion" value="22" />
<gap:plugin name="cordova-plugin-camera" source="npm" />

the html:

<img id="myimage" src="" />

and the js :

function capturePhoto() 
{       
    navigator.camera.getPicture(onPhotoDataSuccessAndroid, onFail, { 
        quality: 30,
        sourceType : Camera.PictureSourceType.PHOTOLIBRARY,
        destinationType: Camera.DestinationType.FILE_URI
        });
}

function onPhotoDataSuccessAndroid(imageURI) {  
    myimagetmp = document.getElementById('myimage');        
    myimagetmp.style.display = 'block';     
    myimagetmp.src = imageURI;                  
}

To add more indications, even if i'm using the following code, the app is still refreshing :

function capturePhoto() 
{       
    navigator.camera.getPicture(onPhotoDataSuccessAndroid, onFail, { 
        quality: 30,
        sourceType : Camera.PictureSourceType.PHOTOLIBRARY,
        destinationType: Camera.DestinationType.FILE_URI
        });
}

function onPhotoDataSuccessAndroid(imageURI) {  
    // Nothing inside               
}
Will
  • 1
  • 2

1 Answers1

0

if you havn't found a solution so far, you could try updating your used library of cordova-plugin-camera (anyways you should provide a version here to make sure an update of the plugin doesn't break your application)

If there's no update available yet, I'd suggest to downgrade to the previous working cli of phonegap.

<preference name="phonegap-version" value="cli-6.X.X" />
devjsp
  • 146
  • 6