Return-Path: X-Original-To: apmail-cordova-issues-archive@minotaur.apache.org Delivered-To: apmail-cordova-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BB489173CE for ; Fri, 29 Jan 2016 15:36:41 +0000 (UTC) Received: (qmail 65652 invoked by uid 500); 29 Jan 2016 15:36:40 -0000 Delivered-To: apmail-cordova-issues-archive@cordova.apache.org Received: (qmail 65522 invoked by uid 500); 29 Jan 2016 15:36:40 -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 65459 invoked by uid 99); 29 Jan 2016 15:36:40 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Jan 2016 15:36:40 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id D584A2C1F54 for ; Fri, 29 Jan 2016 15:36:39 +0000 (UTC) Date: Fri, 29 Jan 2016 15:36:39 +0000 (UTC) From: =?utf-8?Q?Rolf_W=C3=BCrth_=28JIRA=29?= To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CB-10471) Windows 10 Universal App: Click on Toast Notification launches new instance of app when application is already started MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CB-10471?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D151236= 01#comment-15123601 ]=20 Rolf W=C3=BCrth commented on CB-10471: --------------------------------- [~daserge]: yes, this does the trick. Thanks! > Windows 10 Universal App: Click on Toast Notification launches new instan= ce of app when application is already started > -------------------------------------------------------------------------= --------------------------------------------- > > Key: CB-10471 > URL: https://issues.apache.org/jira/browse/CB-10471 > Project: Apache Cordova > Issue Type: Bug > Components: Windows > Affects Versions: 5.4.0 > Environment: Windows 10 Universal APP, Cordova Windows 4.3.0 > Reporter: Rolf W=C3=BCrth > Priority: Critical > Labels: windows > > When one clicks on a Toast Notification in a Windows 10 Cordova App and a= pplication is already running, the click launches a new instance of the app= and goes back to loading the app. > Steps to reproduce: > # Create new Appache Cordova App with Visual Studio > # Go to index.js and add a new function for a toast notification an call = that funciton inside oft the onDeviceReady function > # Start the app on Windows 10 or a Windows 10 emulator > # When the app is started and the toast is displayed, click on the toast = notification --> then the app is initialized again and the toast is shown a= gain - and so on... check example code below > {code} > (function () { > "use strict"; > document.addEventListener( 'deviceready', onDeviceReady.bind( this ),= false ); > function onDeviceReady() { > // Handle the Cordova pause and resume events > document.addEventListener( 'pause', onPause.bind( this ), false )= ; > document.addEventListener('resume', onResume.bind(this), false); > =20 > // invoke a windows toast notification -> this will restart the = app > _localToastNotification("Hello cordova"); > }; > function onPause() { > // TODO: This application has been suspended. Save application st= ate here. > }; > function onResume() { > // TODO: This application has been reactivated. Restore applicati= on state here. > }; > var _localToastNotification =3D function (message) { > var notifications =3D Windows.UI.Notifications; > var notificationManager =3D notifications.ToastNotificationManage= r; > var template =3D notifications.ToastTemplateType.toastImageAndTex= t04; > var toastXml =3D notificationManager.getTemplateContent(notificat= ions.ToastTemplateType[template]); > toastXml.documentElement.setAttribute("launch", "notifier"); > var toastImageElements =3D toastXml.getElementsByTagName("image")= ; > toastImageElements[0].setAttribute("src", "www/img/Star_of_life.p= ng"); > var toastTextElements =3D toastXml.getElementsByTagName("text"); > toastTextElements[0].appendChild(toastXml.createTextNode(message)= ); > var toast =3D new notifications.ToastNotification(toastXml); > notificationManager.createToastNotifier().show(toast); > }; > } )(); > {code}=20 -- 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