{"action":"created","issue":{"url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/1819","repository_url":"https://api.github.com/repos/phonegap/phonegap-plugin-push","labels_url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/1819/labels{/name}","comments_url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/1819/comments","events_url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/1819/events","html_url":"https://github.com/phonegap/phonegap-plugin-push/issues/1819","id":239857878,"number":1819,"title":"Android - app doesn't come to foreground when clicking notification","user":{"login":"szh","id":546965,"avatar_url":"https://avatars2.githubusercontent.com/u/546965?v=4","gravatar_id":"","url":"https://api.github.com/users/szh","html_url":"https://github.com/szh","followers_url":"https://api.github.com/users/szh/followers","following_url":"https://api.github.com/users/szh/following{/other_user}","gists_url":"https://api.github.com/users/szh/gists{/gist_id}","starred_url":"https://api.github.com/users/szh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szh/subscriptions","organizations_url":"https://api.github.com/users/szh/orgs","repos_url":"https://api.github.com/users/szh/repos","events_url":"https://api.github.com/users/szh/events{/privacy}","received_events_url":"https://api.github.com/users/szh/received_events","type":"User","site_admin":false},"labels":[{"id":307723242,"url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/labels/android","name":"android","color":"BFD4F2","default":false},{"id":347013053,"url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/labels/can't%20reproduce","name":"can't reproduce","color":"cccccc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2017-06-30T18:38:20Z","updated_at":"2017-08-23T12:52:53Z","closed_at":null,"body":"### Expected Behaviour\r\nWhen clicking a data notification while the app is in the background (but still in memory), the app should launch.\r\n\r\n### Actual Behaviour\r\nThe on('notification') handler is called, but the app stays in the background and doesn't appear on the screen.\r\n\r\n### Reproduce Scenario (including but not limited to)\r\n\r\n#### Steps to Reproduce \r\nSend a notification that contains a title and body as well as data key-value pairs, following the recommendation of the [docs](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md#notification-vs-data-payloads) to put all the values in the 'data' object (see below for sample payload).\r\nWhen the app is in the foreground, the on('notification') listener is called and the notification is not shown in the system tray, as expected.\r\nWhen the app is no longer in memory, the notification shows in the system tray, and when clicked, the app opens and the on('notification') listener is called, as expected.\r\nHowever, when the app is in the background but still in memory, the notification is shown in the system tray as expected, but when clicking the notification, only the on('notification') listener is called, but the app doesn't come to the foreground.\r\n\r\n#### Platform and Version (eg. Android 5.0 or iOS 9.2.1)\r\nAndroid 6.0\r\n\r\n#### (Android) What device vendor (e.g. Samsung, HTC, Sony...)\r\nMotorola Moto X 2nd Generation\r\n\r\n#### Cordova CLI version and cordova platform version\r\n\r\n    cordova --version\r\n7.0.1\r\n\r\n    cordova platform version android\r\n6.3.2\r\n\r\n#### Plugin version\r\n\r\n    cordova plugin version | grep phonegap-plugin-push\r\n2.0.0-rc5\r\n\r\n#### Sample Push Data Payload\r\n```js\r\n{\r\n  \"registration_ids\": [\r\n    \"...\", \"...\"\r\n  ],\r\n  \"collapse_key\": \"Lorem ipsum\",\r\n  \"priority\": \"normal\",\r\n  \"content_available\": true, /* Same results if using 'content-available': 1 in the 'data' object */\r\n  \"restricted_package_name\": \"com.myapp\",\r\n  \"data\": {\r\n    \"title\": \"Notification title\",\r\n    \"body\": \"Notification text\",\r\n    \"badge\": 10,\r\n    \"Foo\": \"bar\",\r\n    \"somekey\": \"somevalue\"\r\n  }\r\n}\r\n```\r\n\r\n#### Sample Code that illustrates the problem\r\n```js\r\nvar push = PushNotification.init({\r\n  android: { senderID: \"...\" },\r\n  ios: {\r\n\talert: true,\r\n\tbadge: true,\r\n\tsound: true\r\n  }\r\n});\r\n\r\npush.on(\"notification\", (data) => {\r\n  console.log(\"Notification received:\");\r\n  console.log(data);\r\n})\r\n```"},"comment":{"url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/comments/324320080","html_url":"https://github.com/phonegap/phonegap-plugin-push/issues/1819#issuecomment-324320080","issue_url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/1819","id":324320080,"user":{"login":"MarsupiL","id":4199334,"avatar_url":"https://avatars0.githubusercontent.com/u/4199334?v=4","gravatar_id":"","url":"https://api.github.com/users/MarsupiL","html_url":"https://github.com/MarsupiL","followers_url":"https://api.github.com/users/MarsupiL/followers","following_url":"https://api.github.com/users/MarsupiL/following{/other_user}","gists_url":"https://api.github.com/users/MarsupiL/gists{/gist_id}","starred_url":"https://api.github.com/users/MarsupiL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarsupiL/subscriptions","organizations_url":"https://api.github.com/users/MarsupiL/orgs","repos_url":"https://api.github.com/users/MarsupiL/repos","events_url":"https://api.github.com/users/MarsupiL/events{/privacy}","received_events_url":"https://api.github.com/users/MarsupiL/received_events","type":"User","site_admin":false},"created_at":"2017-08-23T12:52:53Z","updated_at":"2017-08-23T12:52:53Z","body":"same"}}
{"actor":{"display_login":"MarsupiL"}}