{"action":"created","issue":{"url":"https://api.github.com/repos/evollu/react-native-fcm/issues/241","repository_url":"https://api.github.com/repos/evollu/react-native-fcm","labels_url":"https://api.github.com/repos/evollu/react-native-fcm/issues/241/labels{/name}","comments_url":"https://api.github.com/repos/evollu/react-native-fcm/issues/241/comments","events_url":"https://api.github.com/repos/evollu/react-native-fcm/issues/241/events","html_url":"https://github.com/evollu/react-native-fcm/issues/241","id":196407368,"number":241,"title":"Sometimes it works, sometimes not...","user":{"login":"RatFou","id":11330245,"avatar_url":"https://avatars.githubusercontent.com/u/11330245?v=3","gravatar_id":"","url":"https://api.github.com/users/RatFou","html_url":"https://github.com/RatFou","followers_url":"https://api.github.com/users/RatFou/followers","following_url":"https://api.github.com/users/RatFou/following{/other_user}","gists_url":"https://api.github.com/users/RatFou/gists{/gist_id}","starred_url":"https://api.github.com/users/RatFou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RatFou/subscriptions","organizations_url":"https://api.github.com/users/RatFou/orgs","repos_url":"https://api.github.com/users/RatFou/repos","events_url":"https://api.github.com/users/RatFou/events{/privacy}","received_events_url":"https://api.github.com/users/RatFou/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-19T12:55:54Z","updated_at":"2016-12-20T17:22:03Z","closed_at":null,"body":"Hi, I'm using RN 0.39, working on Android version.\r\n\r\nI use react-native-fcm to push some news. Sometimes I have the alert I added and sometimes not when the app is in background. I have not this issue if the app is closed.\r\n\r\nMy code:\r\n```\r\nimport React, { Component } from 'react';\r\nimport { AppRegistry, StyleSheet, Text, View } from 'react-native';\r\nimport FCM from 'react-native-fcm';\r\n\r\nexport default class app extends Component {\r\n\tcomponentDidMount() {\r\n        FCM.getFCMToken().then(token => {\r\n            console.log(token)\r\n            // store fcm token in your server\r\n        });\r\n\tFCM.subscribeToTopic('Some');\r\n\tFCM.on(\"notification\", notif => { this._getNewNotification(notif) });\r\n\tFCM.getInitialNotification().then(notif => { this._getNewNotification(notif) });\r\n    }\r\n\r\n\trender() {\r\n\t\treturn (\r\n\t\t\t<View style={styles.container}>\r\n\t\t\t\t<Text style={styles.welcome}>Welcome to React Native!</Text>\r\n\t\t\t\t<Text style={styles.instructions}>To get started, edit index.android.js</Text>\r\n\t\t\t\t<Text style={styles.instructions}>Double tap R on your keyboard to reload,{'\\n'}Shake or press menu button for dev menu</Text>\r\n\t\t\t</View>\r\n\t\t);\r\n\t}\r\n\t\r\n\t_getNewNotification(notif) {\r\n\t\tjson = JSON.stringify(notif);\r\n\t\tdata = JSON.parse(json);\r\n\t\talert(data.fcm.action);\r\n\t}\r\n}\r\n\r\nconst styles = StyleSheet.create({\r\n\tcontainer: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', },\r\n\twelcome: { fontSize: 20, textAlign: 'center', margin: 10, },\r\n\tinstructions: { textAlign: 'center', color: '#333333', marginBottom: 5, },\r\n});\r\n\r\nAppRegistry.registerComponent('app', () => app);\r\n```\r\n\r\nDo you have any idea to solve this issue please?"},"comment":{"url":"https://api.github.com/repos/evollu/react-native-fcm/issues/comments/268303038","html_url":"https://github.com/evollu/react-native-fcm/issues/241#issuecomment-268303038","issue_url":"https://api.github.com/repos/evollu/react-native-fcm/issues/241","id":268303038,"user":{"login":"RatFou","id":11330245,"avatar_url":"https://avatars.githubusercontent.com/u/11330245?v=3","gravatar_id":"","url":"https://api.github.com/users/RatFou","html_url":"https://github.com/RatFou","followers_url":"https://api.github.com/users/RatFou/followers","following_url":"https://api.github.com/users/RatFou/following{/other_user}","gists_url":"https://api.github.com/users/RatFou/gists{/gist_id}","starred_url":"https://api.github.com/users/RatFou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RatFou/subscriptions","organizations_url":"https://api.github.com/users/RatFou/orgs","repos_url":"https://api.github.com/users/RatFou/repos","events_url":"https://api.github.com/users/RatFou/events{/privacy}","received_events_url":"https://api.github.com/users/RatFou/received_events","type":"User","site_admin":false},"created_at":"2016-12-20T17:22:03Z","updated_at":"2016-12-20T17:22:03Z","body":"Already done, to high :)"}}
{"actor":{"display_login":"RatFou"}}