[
https://issues.apache.org/jira/browse/CB-10270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15138566#comment-15138566
]
ASF GitHub Bot commented on CB-10270:
-------------------------------------
Github user shaoner commented on the pull request:
https://github.com/apache/cordova-plugin-camera/pull/160#issuecomment-181769966
@riknoll yes, actually if you don't set correctOrientation to true,
getRealPath is never called, it returns the uri instead (I don't see why) so
this is not empty:
```java
if (this.targetHeight == -1 && this.targetWidth == -1 &&
(destType == FILE_URI || destType == NATIVE_URI) &&
!this.correctOrientation) {
this.callbackContext.success(uri.toString());
```
However, I think we have two issues here:
1. getRealPath should be called even with correctOrientation set to false
2. `FileHelper.getRealPathFromURI_API19` throws an exception, returning an
empty path in some cases:
- happens with my galaxy S4 device (android v5.0.1) and I guess it
cannot be reproduced with a S4 emulator unless the same rom is used
- does not happen with a nexus S emulator (android v5.1.1)
( this seems to be the case for LG G3 as well,
http://stackoverflow.com/questions/2789276/android-get-real-path-by-uri-getpath/33074944#33074944
)
For now, I've got it working by returning `getRealPathFromURI_BelowAPI11`
if the path is empty.
> camera.getPicture() returns an empty string
> -------------------------------------------
>
> Key: CB-10270
> URL: https://issues.apache.org/jira/browse/CB-10270
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugin Camera
> Affects Versions: 2.1.0
> Environment: Android 4.4.2 (api 19)
> Reporter: Alexander Sorokin
> Assignee: Richard B Knoll
> Priority: Critical
> Labels: android, reproduced, triaged
> Attachments: mobilespec-camera.7z
>
>
> Code sample to reproduce:
> {code}
> navigator.camera.getPicture(onSuccess, onFail, {
> destinationType: Camera.DestinationType.FILE_URI,
> sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
> correctOrientation: true
> });
> {code}
> {{onSuccess}} is called with an empty string as an argument.
> if {{correctOrientation}} is {{false}}, everything works as expected.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]