{"action":"created","issue":{"url":"https://api.github.com/repos/evollu/react-native-fcm/issues/412","repository_url":"https://api.github.com/repos/evollu/react-native-fcm","labels_url":"https://api.github.com/repos/evollu/react-native-fcm/issues/412/labels{/name}","comments_url":"https://api.github.com/repos/evollu/react-native-fcm/issues/412/comments","events_url":"https://api.github.com/repos/evollu/react-native-fcm/issues/412/events","html_url":"https://github.com/evollu/react-native-fcm/issues/412","id":230057253,"number":412,"title":"[android] Not receiving messages from Firebase","user":{"login":"tomasdelima","id":5968975,"avatar_url":"https://avatars0.githubusercontent.com/u/5968975?v=3","gravatar_id":"","url":"https://api.github.com/users/tomasdelima","html_url":"https://github.com/tomasdelima","followers_url":"https://api.github.com/users/tomasdelima/followers","following_url":"https://api.github.com/users/tomasdelima/following{/other_user}","gists_url":"https://api.github.com/users/tomasdelima/gists{/gist_id}","starred_url":"https://api.github.com/users/tomasdelima/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomasdelima/subscriptions","organizations_url":"https://api.github.com/users/tomasdelima/orgs","repos_url":"https://api.github.com/users/tomasdelima/repos","events_url":"https://api.github.com/users/tomasdelima/events{/privacy}","received_events_url":"https://api.github.com/users/tomasdelima/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-05-19T18:42:32Z","updated_at":"2017-05-19T18:43:23Z","closed_at":null,"body":"RN: 0.43\r\nOS: Android 5.0.2 device\r\n\r\nI have my app configured to show local notifications, and a FireBase app ready to send notifications.\r\nThe problem is, whenever I try to send a test push notification to my specific device, it does not receive it, no matter the app state.\r\n\r\nThis is my current code:\r\n\r\n```\r\nimport React, { Component } from 'react'\r\nimport {\r\n  View,\r\n  Text,\r\n  Button,\r\n  AsyncStorage,\r\n  Share,\r\n} from 'react-native'\r\nimport FCM, {FCMEvent, RemoteNotificationResult, WillPresentNotificationResult, NotificationType} from 'react-native-fcm'\r\n\r\nmodule.exports = React.createClass({\r\n  componentDidMount () {\r\n    FCM.getInitialNotification().then(notif=>this.setState({notification: JSON.stringify(notif)}))\r\n    this.syncFCMToken()\r\n    this.listenToNotifications()\r\n    this.listenToTokenRefresh()\r\n  },\r\n  syncFCMToken () {\r\n    AsyncStorage.getItem('token', (token) => {\r\n      this.setState({token: token})\r\n      if (!token) {\r\n        FCM.getFCMToken().then(token => {\r\n          AsyncStorage.setItem('token', token)\r\n          this.registerTokenOnServer(token)\r\n          this.setState({token: token})\r\n        })\r\n      }\r\n    })\r\n  },\r\n  registerTokenOnServer (token) {\r\n    var url = global.domain + 'api/v1/devices'\r\n    var t = new Date()\r\n    var data = {os: 'android', token: token}\r\n\r\n    if (global.db.shouldLog) console.log('TOKEN: ' + url + ' => ' + JSON.stringify(data))\r\n    fetch(url, {\r\n      method: 'POST',\r\n      headers: {'Accept': 'application/json', 'Content-Type': 'application/json'},\r\n      body: JSON.stringify(data)\r\n    })\r\n      .then(() => {\r\n        if (global.db.shouldLog) console.log('TOKEN: ' + (new Date() - t)/1000 + ' seconds')\r\n        this.setState({message: {type: 'success', body: token || 'no token'}})\r\n      })\r\n      .catch((e) => {\r\n        console.log('TOKEN: ERROR: ' + e)\r\n        this.setState({message: {type: 'error', body: e}})\r\n      })\r\n  },\r\n  listenToNotifications () {\r\n    this.notificationListener = FCM.on(FCMEvent.Notification, async (notif) => {\r\n      if(notif.local_notification){\r\n        this.setState({notification: 'Received a local notification'})\r\n      }\r\n      if(notif.opened_from_tray){\r\n        this.setState({notification: 'App opened'})\r\n      }\r\n    })\r\n  },\r\n  listenToTokenRefresh () {\r\n    this.refreshTokenListener = FCM.on(FCMEvent.RefreshToken, (token) => {\r\n      this.setState({notification: 'refresh'})\r\n    })\r\n  },\r\n  sendLocalNotification (notif) {\r\n    FCM.presentLocalNotification({\r\n      id: \"UNIQ_ID_STRING\",\r\n      title: \"My Notification Title\",\r\n      body: \"My Notification Message\",\r\n      sound: \"default\",\r\n      priority: \"high\",\r\n      click_action: \"ACTION\",\r\n      badge: 10,\r\n      number: 10,\r\n      ticker: \"My Notification Ticker\",\r\n      auto_cancel: true,\r\n      large_icon: \"ic_launcher\",\r\n      icon: \"ic_launcher\",\r\n      big_text: \"Show when notification is expanded\",\r\n      sub_text: \"This is a subText\",\r\n      color: \"red\",\r\n      vibrate: 300,\r\n      tag: 'some_tag',\r\n      group: \"group\",\r\n      my_custom_data: 'my_custom_field_value',\r\n      lights: true,\r\n      show_in_foreground: true,\r\n    })\r\n  },\r\n  componentWillUnmount () {\r\n    this.notificationListener.remove()\r\n    this.refreshTokenListener.remove()\r\n  },\r\n  getInitialState() {\r\n    return {}\r\n  },\r\n  render () {\r\n    return <Button title={\"share token: \" + this.state.notification} onPress={() => Share.share({message: this.state.token})}/>\r\n  }\r\n})\r\n```\r\n\r\nI have looked at other issues, but none helped me.\r\nThanks in advance"},"comment":{"url":"https://api.github.com/repos/evollu/react-native-fcm/issues/comments/302780934","html_url":"https://github.com/evollu/react-native-fcm/issues/412#issuecomment-302780934","issue_url":"https://api.github.com/repos/evollu/react-native-fcm/issues/412","id":302780934,"user":{"login":"tomasdelima","id":5968975,"avatar_url":"https://avatars0.githubusercontent.com/u/5968975?v=3","gravatar_id":"","url":"https://api.github.com/users/tomasdelima","html_url":"https://github.com/tomasdelima","followers_url":"https://api.github.com/users/tomasdelima/followers","following_url":"https://api.github.com/users/tomasdelima/following{/other_user}","gists_url":"https://api.github.com/users/tomasdelima/gists{/gist_id}","starred_url":"https://api.github.com/users/tomasdelima/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomasdelima/subscriptions","organizations_url":"https://api.github.com/users/tomasdelima/orgs","repos_url":"https://api.github.com/users/tomasdelima/repos","events_url":"https://api.github.com/users/tomasdelima/events{/privacy}","received_events_url":"https://api.github.com/users/tomasdelima/received_events","type":"User","site_admin":false},"created_at":"2017-05-19T18:43:23Z","updated_at":"2017-05-19T18:43:23Z","body":"@evollu Is there something I can do?"}}
{"actor":{"display_login":"tomasdelima"}}