cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Shakhnazarov (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-10471) Windows 10 Universal App: Click on Toast Notification launches new instance of app when application is already started
Date Fri, 29 Jan 2016 12:48:39 GMT

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

Sergey Shakhnazarov commented on CB-10471:
------------------------------------------

[~rolphes], could you please take a look if the patch for CB-10446 fixes this issue as well?

> 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-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message