{"action":"created","issue":{"url":"https://api.github.com/repos/invertase/react-native-firebase/issues/1374","repository_url":"https://api.github.com/repos/invertase/react-native-firebase","labels_url":"https://api.github.com/repos/invertase/react-native-firebase/issues/1374/labels{/name}","comments_url":"https://api.github.com/repos/invertase/react-native-firebase/issues/1374/comments","events_url":"https://api.github.com/repos/invertase/react-native-firebase/issues/1374/events","html_url":"https://github.com/invertase/react-native-firebase/issues/1374","id":348089953,"node_id":"MDU6SXNzdWUzNDgwODk5NTM=","number":1374,"title":"The event \"firebase.messaging().onMessage\" is not called on a real device","user":{"login":"sturmenta","id":30802967,"node_id":"MDQ6VXNlcjMwODAyOTY3","avatar_url":"https://avatars3.githubusercontent.com/u/30802967?v=4","gravatar_id":"","url":"https://api.github.com/users/sturmenta","html_url":"https://github.com/sturmenta","followers_url":"https://api.github.com/users/sturmenta/followers","following_url":"https://api.github.com/users/sturmenta/following{/other_user}","gists_url":"https://api.github.com/users/sturmenta/gists{/gist_id}","starred_url":"https://api.github.com/users/sturmenta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sturmenta/subscriptions","organizations_url":"https://api.github.com/users/sturmenta/orgs","repos_url":"https://api.github.com/users/sturmenta/repos","events_url":"https://api.github.com/users/sturmenta/events{/privacy}","received_events_url":"https://api.github.com/users/sturmenta/received_events","type":"User","site_admin":false},"labels":[{"id":976104936,"node_id":"MDU6TGFiZWw5NzYxMDQ5MzY=","url":"https://api.github.com/repos/invertase/react-native-firebase/labels/await-invertase-feedback","name":"await-invertase-feedback","color":"fbca04","default":false},{"id":576623502,"node_id":"MDU6TGFiZWw1NzY2MjM1MDI=","url":"https://api.github.com/repos/invertase/react-native-firebase/labels/messaging","name":"messaging","color":"0052cc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-08-06T21:34:24Z","updated_at":"2018-08-29T09:33:52Z","closed_at":null,"author_association":"NONE","body":"### Issue\r\n\r\nIn the background the notification arrives correctly, but if you have the application open and you are using a real device, the event \"firebase.messaging().OnMessage\" is not called\r\n\r\n[notification arrives gif](https://drive.google.com/open?id=17M53YQY9sMlJx1PBNdAgCMCoCijP0iSw)\r\n\r\n[event is not called gif](https://drive.google.com/open?id=1WKjq-bcudoLsT20P080PWPS2x86kP1U3)\r\n\r\n[event is not called 2 gif](https://drive.google.com/open?id=13k74tbm83GGnmkQkr2lS4gG7wUJ-zbUn)\r\n\r\n```javascript\r\nfirebase.messaging().onMessage(() => {\r\n\talert('Notification received!');\r\n});\r\n```\r\n\r\n### Environment\r\n\r\n1. Application Target Platform: Both\r\n\r\n2. Development Operating System: macOS Sierra\r\n\r\n3. `React Native` version: 0.56.0\r\n\r\n4. `React Native Firebase` version: 4.3.8\r\n\r\n5. `Firebase` Module: Cloud messaging"},"comment":{"url":"https://api.github.com/repos/invertase/react-native-firebase/issues/comments/416889605","html_url":"https://github.com/invertase/react-native-firebase/issues/1374#issuecomment-416889605","issue_url":"https://api.github.com/repos/invertase/react-native-firebase/issues/1374","id":416889605,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNjg4OTYwNQ==","user":{"login":"calintamasyopeso","id":40857863,"node_id":"MDQ6VXNlcjQwODU3ODYz","avatar_url":"https://avatars3.githubusercontent.com/u/40857863?v=4","gravatar_id":"","url":"https://api.github.com/users/calintamasyopeso","html_url":"https://github.com/calintamasyopeso","followers_url":"https://api.github.com/users/calintamasyopeso/followers","following_url":"https://api.github.com/users/calintamasyopeso/following{/other_user}","gists_url":"https://api.github.com/users/calintamasyopeso/gists{/gist_id}","starred_url":"https://api.github.com/users/calintamasyopeso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calintamasyopeso/subscriptions","organizations_url":"https://api.github.com/users/calintamasyopeso/orgs","repos_url":"https://api.github.com/users/calintamasyopeso/repos","events_url":"https://api.github.com/users/calintamasyopeso/events{/privacy}","received_events_url":"https://api.github.com/users/calintamasyopeso/received_events","type":"User","site_admin":false},"created_at":"2018-08-29T09:33:52Z","updated_at":"2018-08-29T09:33:52Z","author_association":"NONE","body":"I have found the solution. Use the `onNotification` method as described below.\r\n\r\n```javascript\r\nfirebase.notifications().onNotification((notification) => {\r\n  firebase.notifications().displayNotification(notification);\r\n});\r\n```\r\n\r\n"}}
{"actor":{"display_login":"calintamasyopeso"}}