You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Vladimir Kotikov (JIRA)" <ji...@apache.org> on 2016/08/23 12:21:21 UTC

[jira] [Commented] (CB-11295) Cordova app navigates to home screen when fetching image from PhotoLibrary

    [ https://issues.apache.org/jira/browse/CB-11295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15432699#comment-15432699 ] 

Vladimir Kotikov commented on CB-11295:
---------------------------------------

This is hardly ever will be fixed due to Windows Phone Image pickers implementation. In short, choosing image from gallery causes app to suspend until image is picked and then resume with _start_ page (as defined in config.xml). If you have called {{getPicture}} from different page, this will cause the whole app to reload and open start page. In addition, callbacks to {{getPicture}} also get wiped in this case so you'll never get any result from the plugin.

Workaround here might be to _call {{camera.getPicture}} only from start page_, or if this is not possible, subscribe to document's {{activated}} event on main page, then get image from event's arguments, navigate to page, where {{getPicture}} has been called initially from and use image from {{activated}} event. A similar pattern is used in official documentation for file picker on MSDN: https://msdn.microsoft.com/en-us/library/windows/apps/dn720490.aspx

> Cordova app navigates to home screen when fetching image from PhotoLibrary
> --------------------------------------------------------------------------
>
>                 Key: CB-11295
>                 URL: https://issues.apache.org/jira/browse/CB-11295
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Camera
>            Reporter: Apoorv Saxena
>              Labels: camera, cordova-6.0.0, windows-universal
>
> **Use Case**: Choose image from Gallery and execute callbacks
> **Issue**: Redirection to Home screen of the app after image selection from Gallery.
> Getting image from Camera works:
> {noformat}
>     navigator.camera.getPicture(function() {
>     	console.log('success'); 
>     },function() {
>     	console.log('failure'); 
>     } , {
>     	destinationType: Camera.DestinationType.DATA_URL
>     });
> {noformat}
> Choosing image from Gallery redirects to the homescreen
> {noformat}
>     navigator.camera.getPicture(function() {
>     	console.log('success'); 
>     },function() {
>     	console.log('failure'); 
>     } , {
>         destinationType: navigator.camera.DestinationType.FILE_URI,
>     	sourceType: navigator.camera.PictureSourceType.SAVEDPHOTOALBUM
>     });
> {noformat}
> The code is fairly simple and is mentioned at many places to give an example of how to choose image from Gallery. This code doesn't work on any screen other than the home screen of App. Also, no errors are reported before redirection.
> The following code also results in redirection to the homescreen after image selection.
> {noformat}
>     <input type="file" name="">
> {noformat}
> Configuration:
>     Device: Windows Lumia 535
>     Device OS Version: 8.1
>     Cordova: 6.1.1 
>     Cordova plugin camera: 2.2.0



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org