Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D9893200B0F for ; Thu, 2 Jun 2016 14:28:00 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D4E9C160A16; Thu, 2 Jun 2016 12:28:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2F659160A3F for ; Thu, 2 Jun 2016 14:28:00 +0200 (CEST) Received: (qmail 47992 invoked by uid 500); 2 Jun 2016 12:27:59 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 47969 invoked by uid 99); 2 Jun 2016 12:27:59 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Jun 2016 12:27:59 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 25E062C1F5A for ; Thu, 2 Jun 2016 12:27:59 +0000 (UTC) Date: Thu, 2 Jun 2016 12:27:59 +0000 (UTC) From: "Tim (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CB-11129) Cannot fire onSuccess handler on getPicture MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 02 Jun 2016 12:28:01 -0000 [ https://issues.apache.org/jira/browse/CB-11129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15312225#comment-15312225 ] Tim commented on CB-11129: -------------------------- Might be related to: https://issues.apache.org/jira/browse/CB-11341 Try adding 'frame-src: *;' to your content-security-policy. > Cannot fire onSuccess handler on getPicture > ------------------------------------------- > > Key: CB-11129 > URL: https://issues.apache.org/jira/browse/CB-11129 > Project: Apache Cordova > Issue Type: Bug > Components: Plugin Camera > Environment: OS X El Capitan (10.11.4) > {code} > $ cordova platform ls > Installed platforms: > android 5.1.1 > Available platforms: > amazon-fireos ~3.6.3 (deprecated) > blackberry10 ~3.8.0 > browser ~4.1.0 > firefoxos ~3.6.3 > ios ~4.1.0 > osx ~4.0.1 > webos ~3.7.0 > {code} > {code} > $ cordova plugin ls > cordova-plugin-camera 2.2.0 "Camera" > cordova-plugin-compat 1.0.0 "Compat" > cordova-plugin-whitelist 1.2.2 "Whitelist" > {code} > ---- > Android Studio 2.0 > Build on April 5, 2016 > ---- > Device > Nexus 5 > Android 6.0.1 > Reporter: Takatsugu Shigeta > > I wrote following sample, but getPicture cannot fire onSuccess handler. > Reproducing steps is like below. > ---- > Building environment > * First of all, I ran following commands. > {code} > $ cordova create myApp org.apache.cordova.myApp myApp > $ cd myApp/ > $ cordova plugin add cordova-plugin-camera --save > $ cordova platform add android --save > $ cordova requirements android > {code} > * Next, run Android Studio, then choose "Import project (Eclipse ADT, Gradle, etc.)" to above myApp directory. > * Edit two files, assets/www/js/index.js and assets/www/index.html. > {code:title=index.js} > var app = { > // Application Constructor > initialize: function() { > this.bindEvents(); > }, > // Bind Event Listeners > // > // Bind any events that are required on startup. Common events are: > // 'load', 'deviceready', 'offline', and 'online'. > bindEvents: function() { > document.addEventListener('deviceready', this.onDeviceReady, false); > }, > // deviceready Event Handler > // > // The scope of 'this' is the event. In order to call the 'receivedEvent' > // function, we must explicitly call 'app.receivedEvent(...);' > onDeviceReady: function() { > app.receivedEvent('deviceready'); > }, > // Update DOM on a Received Event > receivedEvent: function(id) { > var parentElement = document.getElementById(id); > var listeningElement = parentElement.querySelector('.listening'); > var receivedElement = parentElement.querySelector('.received'); > listeningElement.setAttribute('style', 'display:none;'); > receivedElement.setAttribute('style', 'display:block;'); > console.log('Received Event: ' + id); > navigator.camera.getPicture(onSuccess, onFail, { quality: 50, > destinationType: Camera.DestinationType.FILE_URI > }); > } > }; > app.initialize(); > function onSuccess(imageURI) { > alert(imageURI); > var image = document.getElementById('myImage'); > image.src = imageURI; > } > function onFail(message) { > alert('Failed because: ' + message); > } > {code} > {code:title=index.html} > > > > > > > > > Hello World > > >
>

Apache Cordova

> >
> >
>
> > > > > {code} > * Connect Nexus 5 to My Mac. > * Try to run on Android Studio > * On Nexus 5, display camera window after allowing permissions, then take a picture. > * You should see URL on alert. And you should see the image. But getPicture cannot fire onSuccess handler. So I cannot see them. -- 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