{"action":"opened","issue":{"url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/2629","repository_url":"https://api.github.com/repos/phonegap/phonegap-plugin-push","labels_url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/2629/labels{/name}","comments_url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/2629/comments","events_url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/2629/events","html_url":"https://github.com/phonegap/phonegap-plugin-push/issues/2629","id":383042634,"node_id":"MDU6SXNzdWUzODMwNDI2MzQ=","number":2629,"title":"on notification ios does not work?","user":{"login":"eros2187","id":5880552,"node_id":"MDQ6VXNlcjU4ODA1NTI=","avatar_url":"https://avatars1.githubusercontent.com/u/5880552?v=4","gravatar_id":"","url":"https://api.github.com/users/eros2187","html_url":"https://github.com/eros2187","followers_url":"https://api.github.com/users/eros2187/followers","following_url":"https://api.github.com/users/eros2187/following{/other_user}","gists_url":"https://api.github.com/users/eros2187/gists{/gist_id}","starred_url":"https://api.github.com/users/eros2187/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eros2187/subscriptions","organizations_url":"https://api.github.com/users/eros2187/orgs","repos_url":"https://api.github.com/users/eros2187/repos","events_url":"https://api.github.com/users/eros2187/events{/privacy}","received_events_url":"https://api.github.com/users/eros2187/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-21T10:06:26Z","updated_at":"2018-11-21T10:06:26Z","closed_at":null,"author_association":"NONE","body":"### Expected Behaviour\r\n\r\n### Actual Behaviour\r\n\r\n### Reproduce Scenario (including but not limited to)\r\n\r\n#### Steps to Reproduce \r\n\r\n####  iOS 9.2.1\r\n\r\n#### (Android) What device vendor (e.g. Samsung, HTC, Sony...)\r\n\r\n#### Cordova CLI version and cordova platform version\r\n\r\n    cordova --version                                    # e.g.7.1.0\r\n\r\n#### Plugin version\r\n2.2.3\r\n    cordova plugin version | grep phonegap-plugin-push   # e.g. 1.5.3\r\n\r\n#### Sample Push Data Payload\r\n?php\r\n// Put your device token here (without spaces):\r\n$deviceToken = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';\r\n\r\n// Put your private key's passphrase here:\r\n$passphrase = 'xxxxxxxxxxxxxxxxx';\r\n$pemfilename = 'xxxxxxxxxxxxxxx';\r\n\r\n// SIMPLE PUSH\r\n$body['aps'] = array(\r\n\t'alert' => array(\r\n\t\t'title' => \"You have a notification\",\r\n\t\t'body' => \"Body of the message\",\r\n    \"content-available\" => 1\r\n\t),\r\n\t'badge' => 1,\r\n\t'sound' => 'default',\r\n\t); // Create the payload body\r\n\r\n////////////////////////////////////////////////////////////////////////////////\r\n\r\n\r\n$ctx = stream_context_create();\r\nstream_context_set_option($ctx, 'ssl', 'local_cert', $pemfilename);\r\nstream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);\r\n\r\n$fp = stream_socket_client(\r\n\t'ssl://gateway.sandbox.push.apple.com:2195', $err,\r\n\t$errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx); // Open a connection to the APNS server\r\nif (!$fp)\r\n\texit(\"Failed to connect: $err $errstr\" . PHP_EOL);\r\necho 'Connected to APNS' . PHP_EOL;\r\n$payload = json_encode($body); // Encode the payload as JSON\r\n$msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload; // Build the binary notification\r\n$result = fwrite($fp, $msg, strlen($msg)); // Send it to the server\r\nif (!$result)\r\n\techo 'Message not delivered' . PHP_EOL;\r\nelse\r\n\techo 'Message successfully delivered' . PHP_EOL;\r\nfclose($fp); // Close the connection to the server\r\n\r\n\r\n#### Sample Code that illustrates the problem\r\n\r\npush.on('notification', function(data) {\r\n          // data.message,\r\n        \t// data.title,\r\n        \t// data.count,\r\n        \t// data.sound,\r\n        \t// data.image,\r\n        \t// data.additionalData\r\n          alert(JSON.stringify(data));\r\n\r\nwhen app is closed and I receive a notification by clicking on the notification why not call on notification?\r\nwhere my mistake?\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"eros2187"}}