{"action":"created","issue":{"url":"https://api.github.com/repos/NativeScript/push-plugin/issues/115","repository_url":"https://api.github.com/repos/NativeScript/push-plugin","labels_url":"https://api.github.com/repos/NativeScript/push-plugin/issues/115/labels{/name}","comments_url":"https://api.github.com/repos/NativeScript/push-plugin/issues/115/comments","events_url":"https://api.github.com/repos/NativeScript/push-plugin/issues/115/events","html_url":"https://github.com/NativeScript/push-plugin/issues/115","id":215013208,"number":115,"title":"onMessageReceived callback does not triggered on Android","user":{"login":"noetius","id":8258295,"avatar_url":"https://avatars3.githubusercontent.com/u/8258295?v=3","gravatar_id":"","url":"https://api.github.com/users/noetius","html_url":"https://github.com/noetius","followers_url":"https://api.github.com/users/noetius/followers","following_url":"https://api.github.com/users/noetius/following{/other_user}","gists_url":"https://api.github.com/users/noetius/gists{/gist_id}","starred_url":"https://api.github.com/users/noetius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noetius/subscriptions","organizations_url":"https://api.github.com/users/noetius/orgs","repos_url":"https://api.github.com/users/noetius/repos","events_url":"https://api.github.com/users/noetius/events{/privacy}","received_events_url":"https://api.github.com/users/noetius/received_events","type":"User","site_admin":false},"labels":[{"id":241150086,"url":"https://api.github.com/repos/NativeScript/push-plugin/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-03-17T14:06:06Z","updated_at":"2017-04-05T04:40:25Z","closed_at":null,"body":"Hello,\r\nI tried everything to get working the \"onMessageReceived\" callback:\r\n<pre>\r\npushPlugin.areNotificationsEnabled(function(areEnabled) {\r\n    if(areEnabled){\r\n        pushPlugin.register(config.pushPluginConfig, function(token) { \r\n            onReceivedToken(token);         \r\n      });\r\n      pushPlugin.onTokenRefresh( onReceivedToken );\r\n      pushPlugin.onMessageReceived(function callback(message, data, notification) {\r\n          console.dir(message);\r\n      });            \r\n    }\r\n});\r\n</pre>\r\n\r\nThe others callbacks like \"areNotificationEnabled\", \"register\" and \"onTokenRefresh\" work quite good,\r\nbut I'm not able to understand how to get working the \"onMessageReceived\" callback, because every time I send a notification from the FireBase console, it simply doesn't trigger, even if I place it inside the \"register\" callback.\r\n\r\nInstead, the \"addOnMessageReceivedCallback\" from the firebase plugin works smoothly, but I would like  to rely on the Push Plugin callback just not to mix too many approaches together. \r\n\r\nHope there is someone with my same issue."},"comment":{"url":"https://api.github.com/repos/NativeScript/push-plugin/issues/comments/291752325","html_url":"https://github.com/NativeScript/push-plugin/issues/115#issuecomment-291752325","issue_url":"https://api.github.com/repos/NativeScript/push-plugin/issues/115","id":291752325,"user":{"login":"ickata","id":617081,"avatar_url":"https://avatars0.githubusercontent.com/u/617081?v=3","gravatar_id":"","url":"https://api.github.com/users/ickata","html_url":"https://github.com/ickata","followers_url":"https://api.github.com/users/ickata/followers","following_url":"https://api.github.com/users/ickata/following{/other_user}","gists_url":"https://api.github.com/users/ickata/gists{/gist_id}","starred_url":"https://api.github.com/users/ickata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ickata/subscriptions","organizations_url":"https://api.github.com/users/ickata/orgs","repos_url":"https://api.github.com/users/ickata/repos","events_url":"https://api.github.com/users/ickata/events{/privacy}","received_events_url":"https://api.github.com/users/ickata/received_events","type":"User","site_admin":false},"created_at":"2017-04-05T04:40:25Z","updated_at":"2017-04-05T04:40:25Z","body":"OK, this one is expected and is written [in the documentation](https://github.com/NativeScript/push-plugin#handling-notification-messages):\r\n\r\n> If the app is in background, a notification is put in the tray. When tapped, it launches the app, but does not invoke the onMessageReceived callback.\r\n\r\nIt looks like I have to use [data message](https://github.com/NativeScript/push-plugin#handling-data-messages) instead of notification message."}}
{"actor":{"display_login":"ickata"}}