{"action":"created","issue":{"url":"https://api.github.com/repos/invertase/react-native-firebase/issues/1272","repository_url":"https://api.github.com/repos/invertase/react-native-firebase","labels_url":"https://api.github.com/repos/invertase/react-native-firebase/issues/1272/labels{/name}","comments_url":"https://api.github.com/repos/invertase/react-native-firebase/issues/1272/comments","events_url":"https://api.github.com/repos/invertase/react-native-firebase/issues/1272/events","html_url":"https://github.com/invertase/react-native-firebase/issues/1272","id":338179683,"node_id":"MDU6SXNzdWUzMzgxNzk2ODM=","number":1272,"title":"onNotificationOpened not working on Android (background/foreground)","user":{"login":"nopmengkoung","id":23622764,"node_id":"MDQ6VXNlcjIzNjIyNzY0","avatar_url":"https://avatars1.githubusercontent.com/u/23622764?v=4","gravatar_id":"","url":"https://api.github.com/users/nopmengkoung","html_url":"https://github.com/nopmengkoung","followers_url":"https://api.github.com/users/nopmengkoung/followers","following_url":"https://api.github.com/users/nopmengkoung/following{/other_user}","gists_url":"https://api.github.com/users/nopmengkoung/gists{/gist_id}","starred_url":"https://api.github.com/users/nopmengkoung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nopmengkoung/subscriptions","organizations_url":"https://api.github.com/users/nopmengkoung/orgs","repos_url":"https://api.github.com/users/nopmengkoung/repos","events_url":"https://api.github.com/users/nopmengkoung/events{/privacy}","received_events_url":"https://api.github.com/users/nopmengkoung/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-07-04T08:32:50Z","updated_at":"2018-07-10T21:15:52Z","closed_at":null,"author_association":"NONE","body":"<!---\r\nBEFORE YOU MAKE AN ISSUE\r\n\r\nThe issue list of this repo is exclusively for bug reports.\r\n\r\n1) For feature requests, please use our Canny board: https://react-native-firebase.canny.io/feature-requests\r\n\r\n2) For questions and support please use our Discord chat: https://discord.gg/C9aK28N or Stack Overflow: https://stackoverflow.com/questions/tagged/react-native-firebase\r\n\r\n3) If this is a setup issue then please make sure you've correctly followed the setup guides, most setup issues such as 'duplicate dex files', 'default app has not been initialized' etc are all down to an incorrect setup as the guides haven't been correctly followed.\r\n-->\r\n\r\n### Issue\r\n\r\n<!--- Please write your issue here, provide as much detail as you can, code snippets, key files which will help us to debug such as your `Podfile` and/or `app/build.gradle` file). -->\r\nWhen my app is closed and I tapped on notification getInitialNotification is working fine on both platforms, but on android when I tapped on notification and my app is in background/foreground onNotificationOpened didn't triggered. When my app in foreground I display a local notification.\r\n\r\n```javascript\r\nconst notify = new firebase.notifications.Notification()\r\n      .setNotificationId(notification._notificationId)\r\n      .setTitle(notification._title)\r\n      .setBody('Tap here to view more detail')\r\n      .setData({...notification._data})\r\n      .android.setChannelId('notif-channel')\r\n      .android.setSmallIcon('ic_launcher')\r\n\r\n    firebase.notifications().displayNotification(notify)\r\n```\r\n\r\n### Environment\r\n\r\n1. Application Target Platform: Both\r\n\r\n<!--- (e.g. iOS, Android, Both) --->\r\n\r\n2. Development Operating System: macOS High Sierra\r\n\r\n<!--- (e.g. macOS Sierra, Windows 10) --->\r\n\r\n3. Build Tools:\r\n\r\n<!--- (Xcode or Android Studio version, iOS or Android SDK version - if relevant) --->\r\n\r\n4. `React Native` version: 0.54\r\n\r\n<!--- (e.g. 0.52.0) --->\r\n\r\n5. `React Native Firebase` Version: 4.0.4\r\n\r\n<!--- (e.g. 4.3.0) --->\r\n\r\n6. `Firebase` Module: notifications\r\n\r\n<!--- (e.g. database, auth, messaging, analytics etc - or N/A if not applicable) --->\r\n\r\n7. Are you using `typescript`? no\r\n\r\n<!--- yes/no --->\r\n\r\n\r\n---\r\nLoving `react-native-firebase`? Please consider supporting their open collective:\r\n\r\n  👉  [https://opencollective.com/react-native-firebase/donate](https://opencollective.com/react-native-firebase/donate)\r\n"},"comment":{"url":"https://api.github.com/repos/invertase/react-native-firebase/issues/comments/403968504","html_url":"https://github.com/invertase/react-native-firebase/issues/1272#issuecomment-403968504","issue_url":"https://api.github.com/repos/invertase/react-native-firebase/issues/1272","id":403968504,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMzk2ODUwNA==","user":{"login":"dengue8830","id":5104213,"node_id":"MDQ6VXNlcjUxMDQyMTM=","avatar_url":"https://avatars1.githubusercontent.com/u/5104213?v=4","gravatar_id":"","url":"https://api.github.com/users/dengue8830","html_url":"https://github.com/dengue8830","followers_url":"https://api.github.com/users/dengue8830/followers","following_url":"https://api.github.com/users/dengue8830/following{/other_user}","gists_url":"https://api.github.com/users/dengue8830/gists{/gist_id}","starred_url":"https://api.github.com/users/dengue8830/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dengue8830/subscriptions","organizations_url":"https://api.github.com/users/dengue8830/orgs","repos_url":"https://api.github.com/users/dengue8830/repos","events_url":"https://api.github.com/users/dengue8830/events{/privacy}","received_events_url":"https://api.github.com/users/dengue8830/received_events","type":"User","site_admin":false},"created_at":"2018-07-10T21:15:52Z","updated_at":"2018-07-10T21:15:52Z","author_association":"NONE","body":"in my case, i was missing the notification's data setup when building the notification\r\n```\r\n.setNotificationId(fcmNotification.data.notificacionId)\r\n      .setTitle(fcmNotification.title)\r\n      .setBody(fcmNotification.body)\r\n      .setData(fcmNotification.data)\r\n```\r\n\r\nso, when tapping the notification data was undefined :P"}}
{"actor":{"display_login":"dengue8830"}}