Skip to content

Notification onClick reloads app #12

@varepato

Description

@varepato

Expected Behaviour

When click on notification should go to certain state (or view).

Actual Behaviour

When clicked on notification shows a gray screen and reloads app. I can see the notification but when I click on it reloads the app or tries to load the app twice (or open the app again).

Steps to Reproduce

add $state.go('someState'); to the notification.onClick function

Platform and Version (e.g. Android 5.0 or iOS 9.2.1)

Android 5.1

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

Huawei mate S

Cordova CLI version and cordova platform version

global packages:
@ionic/cli-utils : 1.5.0
Cordova CLI : 7.0.1
Gulp CLI : CLI version 3.9.1 Local version 3.9.1
Ionic CLI : 3.5.0

local packages:
@ionic/cli-plugin-cordova : 1.4.1
@ionic/cli-plugin-gulp : 1.0.2
@ionic/cli-plugin-ionic1 : 2.0.1
Cordova Platforms : android 6.1.2
Ionic Framework : unknown

System:
Node : v6.9.2
OS : Windows 10
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
npm : 3.10.9

Plugin version

phonegap-plugin-local-notification 1.0.1

Sample Code that illustrates the problem

if (“Notification” in window) {
 Notification.requestPermission(function (permission) {
   // If the user accepts, let’s create a notification
   if (permission === ‘granted’) {
     var notification = new Notification(“My title”, {
          tag: ‘message1’, 
          body: “My body” 
     }); 
     notification.onshow  = function() { console.log(‘show’); };
     notification.onclose = function() { console.log(‘close’); };
     notification.onclick = function() { $state.go('someState'); };
   }
 });
}

I followed this article https://blog.phonegap.com/release-of-phonegap-local-notification-plugin-bc7f480b6fd6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions