[ 
https://issues.apache.org/jira/browse/CB-10471?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sergey Shakhnazarov resolved CB-10471.
--------------------------------------
    Resolution: Fixed

> Windows 10 Universal App: Click on Toast Notification launches new instance 
> 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ürth
>            Priority: Critical
>              Labels: windows
>
> When one clicks on a Toast Notification in a Windows 10 Cordova App and 
> application 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 
> again - 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);
>          
>          // invoke a windows toast notification -> this will restart the app
>         _localToastNotification("Hello cordova");
>     };
>     function onPause() {
>         // TODO: This application has been suspended. Save application state 
> here.
>     };
>     function onResume() {
>         // TODO: This application has been reactivated. Restore application 
> state here.
>     };
>     var _localToastNotification = function (message) {
>         var notifications = Windows.UI.Notifications;
>         var notificationManager = notifications.ToastNotificationManager;
>         var template = notifications.ToastTemplateType.toastImageAndText04;
>         var toastXml = 
> notificationManager.getTemplateContent(notifications.ToastTemplateType[template]);
>         toastXml.documentElement.setAttribute("launch", "notifier");
>         var toastImageElements = toastXml.getElementsByTagName("image");
>         toastImageElements[0].setAttribute("src", "www/img/Star_of_life.png");
>         var toastTextElements = toastXml.getElementsByTagName("text");
>         toastTextElements[0].appendChild(toastXml.createTextNode(message));
>         var toast = new notifications.ToastNotification(toastXml);
>         notificationManager.createToastNotifier().show(toast);
>     };
> } )();
> {code} 



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

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

Reply via email to