{"action":"created","issue":{"url":"https://api.github.com/repos/evollu/react-native-fcm/issues/756","repository_url":"https://api.github.com/repos/evollu/react-native-fcm","labels_url":"https://api.github.com/repos/evollu/react-native-fcm/issues/756/labels{/name}","comments_url":"https://api.github.com/repos/evollu/react-native-fcm/issues/756/comments","events_url":"https://api.github.com/repos/evollu/react-native-fcm/issues/756/events","html_url":"https://github.com/evollu/react-native-fcm/issues/756","id":291850692,"number":756,"title":"App crashes when receiving push notification in Android foreground only ","user":{"login":"lulzimfazlija","id":3067071,"avatar_url":"https://avatars1.githubusercontent.com/u/3067071?v=4","gravatar_id":"","url":"https://api.github.com/users/lulzimfazlija","html_url":"https://github.com/lulzimfazlija","followers_url":"https://api.github.com/users/lulzimfazlija/followers","following_url":"https://api.github.com/users/lulzimfazlija/following{/other_user}","gists_url":"https://api.github.com/users/lulzimfazlija/gists{/gist_id}","starred_url":"https://api.github.com/users/lulzimfazlija/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lulzimfazlija/subscriptions","organizations_url":"https://api.github.com/users/lulzimfazlija/orgs","repos_url":"https://api.github.com/users/lulzimfazlija/repos","events_url":"https://api.github.com/users/lulzimfazlija/events{/privacy}","received_events_url":"https://api.github.com/users/lulzimfazlija/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2018-01-26T09:59:17Z","updated_at":"2018-02-01T23:57:11Z","closed_at":null,"author_association":"NONE","body":"Tried multiple devices same it crashes, I am using react native 0.49, can receive notifications on background, but not when app is open!\r\nI am using \"react-native-fcm\": \"^11.3.1\" and using google services 11.8.0 on my app bundle!\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/evollu/react-native-fcm/issues/comments/362441600","html_url":"https://github.com/evollu/react-native-fcm/issues/756#issuecomment-362441600","issue_url":"https://api.github.com/repos/evollu/react-native-fcm/issues/756","id":362441600,"user":{"login":"lulzimfazlija","id":3067071,"avatar_url":"https://avatars1.githubusercontent.com/u/3067071?v=4","gravatar_id":"","url":"https://api.github.com/users/lulzimfazlija","html_url":"https://github.com/lulzimfazlija","followers_url":"https://api.github.com/users/lulzimfazlija/followers","following_url":"https://api.github.com/users/lulzimfazlija/following{/other_user}","gists_url":"https://api.github.com/users/lulzimfazlija/gists{/gist_id}","starred_url":"https://api.github.com/users/lulzimfazlija/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lulzimfazlija/subscriptions","organizations_url":"https://api.github.com/users/lulzimfazlija/orgs","repos_url":"https://api.github.com/users/lulzimfazlija/repos","events_url":"https://api.github.com/users/lulzimfazlija/events{/privacy}","received_events_url":"https://api.github.com/users/lulzimfazlija/received_events","type":"User","site_admin":false},"created_at":"2018-02-01T23:57:11Z","updated_at":"2018-02-01T23:57:11Z","author_association":"NONE","body":"@evollu what do you think it is causing the crash on foreground?\r\n\r\nMainapplication.java looks as below:\r\n```\r\n// Needed for `react-native link`\r\n  public List<ReactPackage> getPackages() {\r\n    return Arrays.<ReactPackage>asList(\r\n        // Add your own packages here!\r\n        // TODO: add cool native modules\r\n//            new MainReactPackage(),\r\n\r\n            new RNBackgroundGeolocation(),\r\n            // Needed for `react-native link`\r\n\r\n            new FIRMessagingPackage(),\r\n            //new RNBackgroundGeolocation(),\r\n            //new RNFirebasePackage(),\r\n            new VectorIconsPackage()\r\n            //new RNFirebaseMessagingPackage()\r\n    );\r\n  }\r\n```\r\nand notification handler, listener looks like:\r\n\r\n`this.notificationListener = FCM.on(FCMEvent.Notification, async (notif) => {\r\n            console.warn(\"listening.......................\");\r\n\r\n            if (notif.fcm) {\r\n                console.log(\"sending notification...\");\r\n                this.title = notif.fcm.title\r\n                this.body = notif.fcm.body\r\n\r\n                FCM.presentLocalNotification({\r\n                    title: notif.title,                     // as FCM payload\r\n                    body: notif.body,                    // as FCM payload (required)\r\n                    priority: \"high\",                                   // as FCM payload\r\n                    click_action: \"ACTION\",                             // as FCM payload\r\n                    auto_cancel: true,                                  // Android only (default true)\r\n                    vibrate: 300,                                       // Android only default: 300, no vibration if you pass null\r\n                    lights: true,                                       // Android only, LED blinking (default false)\r\n                    show_in_foreground: true,                           // show notification when app is in foreground (local & remote)\r\n                    local: true\r\n                })\r\n            }\r\n\r\n\r\n            // optional, do some component related stuff\r\n        });`\r\n\r\nANy idea what would it cause the crash on foreground?"}}
{"actor":{"display_login":"lulzimfazlija"}}