Page 1 of 1

Picture Capture on Samsung

Posted: Wed Dec 04, 2019 6:02 pm
by devinst
I am using the following code on a Samsung device. It has been working but recently we started getting an error. I am getting the alert box with a error code of 20 in it. Is there a way I can get the description for error 20?

pui.capturePhoto({
dir: get("ImagePath"),
fileName: "image.jpg",
overwrite: true,
handler: function(response) {
if (response.success) {
pui.click(ImageEITaken);
}
else {
alert(response.error);
}
}
});

Re: Picture Capture on Samsung

Posted: Wed Dec 04, 2019 6:18 pm
by Scott Klement
Its not clear what error you're receiving. You just say "20"? the "response.error" that you are using should contain a message.

Can you post a screenshot?

Re: Picture Capture on Samsung

Posted: Fri Dec 06, 2019 12:59 pm
by devinst
Is this what you need Scott?

Re: Picture Capture on Samsung

Posted: Fri Dec 06, 2019 1:26 pm
by Scott Klement
I've never seen a response like that before. Profound UI does not send any messages that just contain the number "20" like that.

Looking at the code for the pui.capturePhoto() API, there are two places where the handler might get an error code that doesn't originate with Profound UI. They are:

1) When accessing the camera itself, we use the Cordova camera.getPicture() function, and it can return the device's native response code. The documentation for that can be found here: https://cordova.apache.org/docs/en/late ... ra.onError -- however, that doc isn't very helpful, it doesn't list the possible values. I suspect they are different for each mobile device.

2) When uploading the picture to the IBM i, we call Cordova's FileTransfer.upload function. It can return an error code, too, as documented here: https://cordova.apache.org/docs/en/6.x/ ... index.html -- however, I don't think this is what you're seeing, because if that were the case it would say "An error has occurred: Code = 20" instead of just "20". Also, this only documents errors from 1-5, so I don't think 20 is possible.

So I think it's probably #1, above... this is simply the code that the device's camera is returning, and every device returns different values. I don't know what 20 means, sorry.

Re: Picture Capture on Samsung

Posted: Fri Dec 06, 2019 1:38 pm
by Scott Klement
I did some Googling, and it appears that the "20" code is returned by some Android devices to indicate a permission error.

This is the closest thread I can find (and its referring to ionic, which isn't quite the same as what we use) https://forum.ionicframework.com/t/came ... -20/109710

Not sure that I understand 100%, but it sounds like the app doesn't have permission to read from the Camera or its stored pictures. You could try looking for a setting in your phone that allows the app access to the camera?

If that doesn't help, you should file a support ticket so that we can have our developers look into the error further.

Re: Picture Capture on Samsung

Posted: Fri Dec 06, 2019 1:40 pm
by devinst
I would have to agree that it would not be during the upload because the camera never does open so no picture is taken to upload. I will review the link you sent for number 1 and see if I can find any reference on the net about this. I thought it may be a permissions issue but those have been setup as needed. Thanks!!

Re: Picture Capture on Samsung

Posted: Fri Dec 06, 2019 1:42 pm
by devinst
Just saw your latest post Scott. Thanks for the additional info. Looks like the permissions may have been the correct path. I will post back here anything I find for future reference. Thanks Again!!