{
"name": "xxx",
"version": "0.0.1",
"private": true,
"engines": {
"node": ">=10.16.0",
"npm": ">=6.9.0"
},
"scripts": {
"start": "react-native start",
"test": "jest",
"lint": "eslint .",
"reset-cache": "npm start -- --reset-cache",
"fix": "prettier-eslint --write \"src/**/*.{js,jsx,json,css}\"",
"update-i18n": "node ./scripts/update-localizations.js",
"postinstall": "npx jetify"
},
"dependencies": {
"@react-native-community/art": "^1.1.2",
"@react-native-community/async-storage": "^1.7.1",
"@react-native-community/cameraroll": "^1.3.0",
"@react-native-community/datetimepicker": "^2.2.2",
"@react-native-community/geolocation": "^2.0.2",
"@react-native-community/netinfo": "^5.0.0",
"adyen-cse-js": "git+https://github.com/Adyen/adyen-cse-web.git#v0.1.24",
"ajv": "^5.5.1",
"aws-amplify": "^1.2.4",
"eslint-import-resolver-babel-module": "^4.0.0",
"fsevents": "^1.2.9",
"geolib": "^3.2.0",
"instabug-reactnative": "^9.0.1",
"jetifier": "^1.6.3",
"lodash": "^4.17.15",
"moment": "^2.22.2",
"moment-timezone": "^0.5.21",
"node-libs-browser": "2.1.0",
"normalizr": "^3.2.4",
"prop-types": "^15.6.1",
"qs": "^6.7.0",
"querystring": "^0.2.0",
"react": "^16.9.0",
"react-devtools": "^3.4.3",
"react-devtools-core": "^3.4.3",
"react-native": "^0.61.5",
"react-native-adyen-cse": "^1.0.7",
"react-native-amplitude-analytics": "^0.2.7",
"react-native-animatable": "^1.3.3",
"react-native-background-fetch": "^2.7.1",
"react-native-background-geolocation": "^3.4.2",
"react-native-branch": "^4.3.0",
"react-native-calendar-events": "^1.7.3",
"react-native-check-app-install": "0.0.5",
"react-native-dark-mode": "^0.2.1",
"react-native-datepicker": "^1.6.0",
"react-native-device-info": "^5.4.0",
"react-native-elements": "^1.2.7",
"react-native-extended-stylesheet": "^0.12.0",
"react-native-fabric": "git+https://github.com/xxx/react-native-fabric.git#fix/android-warning",
"react-native-fast-image": "^7.0.2",
"react-native-fbsdk": "~1.0.4",
"react-native-firebase": "^5.6.0",
"react-native-fs": "^2.16.2",
"react-native-geolocation-service": "^3.1.0",
"react-native-gesture-handler": "^1.5.2",
"react-native-gifted-chat": "git+https://github.com/xxx/react-native-gifted-chat.git#fix/babel-config",
"react-native-hyperlink": "0.0.18",
"react-native-i18n": "git+https://github.com/xxx/react-native-i18n.git#fix/androidx",
"react-native-image-crop-picker": "^0.26.1",
"react-native-iphone-x-helper": "^1.2.1",
"react-native-keyboard-aware-scroll-view": "^0.9.1",
"react-native-keychain": "^4.0.4",
"react-native-linear-gradient": "^2.5.6",
"react-native-loading-spinner-overlay": "^1.0.1",
"react-native-localize": "^1.3.1",
"react-native-maps": "^0.26.1",
"react-native-masked-text": "^1.13.0",
"react-native-offline": "^5.2.0",
"react-native-pages": "^0.9.0",
"react-native-permissions": "^2.0.9",
"react-native-phone-call": "^1.0.9",
"react-native-progress": "^4.0.3",
"react-native-rate": "^1.1.10",
"react-native-read-more-text": "^1.1.0",
"react-native-reanimated": "^1.4.0",
"react-native-share": "^2.0.0",
"react-native-simple-store": "git+https://github.com/xxx/react-native-simple-store.git#master",
"react-native-smart-gallery": "^1.1.5",
"react-native-snap-carousel": "^3.8.4",
"react-native-status-bar-height": "^2.4.0",
"react-native-swipe-list-view": "^2.1.3",
"react-native-swipeout": "^2.3.6",
"react-native-uuid": "^1.4.9",
"react-native-v8": "^0.61.5-patch.0",
"react-native-vector-icons": "^6.6.0",
"react-native-version-check": "^3.3.1",
"react-native-version-number": "^0.3.6",
"react-native-webview": "^8.0.0",
"react-navigation": "^4.0.10",
"react-navigation-stack": "^1.10.3",
"react-navigation-tabs": "^2.6.2",
"react-redux": "7.0.0",
"redux": "^4.0.4",
"redux-actions": "^2.3.0",
"redux-form": "^8.2.5",
"redux-thunk": "^2.2.0",
"reselect": "^4.0.0",
"rmc-picker": "^5.0.10",
"rn-fetch-blob": "^0.12.0",
"short-uuid": "^3.1.1",
"stream": "0.0.2",
"vm": "^0.1.0"
},
"devDependencies": {
"@babel/core": "^7.6.2",
"@babel/runtime": "^7.6.2",
"@react-native-community/eslint-config": "^0.0.5",
"babel-eslint": "^8.2.2",
"babel-jest": "^24.9.0",
"babel-plugin-module-resolver": "^3.1.0",
"babel-plugin-rewrite-require": "^1.14.5",
"babel-plugin-transform-inline-environment-variables": "^0.3.0",
"eslint": "^6.5.1",
"eslint-config-airbnb": "^17.1.1",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^22.21.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.14.3",
"eslint-plugin-react-native": "^3.7.0",
"firebase-tools": "^7.6.1",
"jest": "^24.9.0",
"localize-spreadsheet-bot": "^0.8.5",
"metro-react-native-babel-preset": "^0.56.0",
"prettier-eslint": "^8.8.2",
"prettier-eslint-cli": "^4.7.1",
"react-test-renderer": "16.9.0",
"redux-devtools-extension": "^2.13.2",
"remote-redux-devtools": "^0.5.12",
"schedule": "^0.4.0"
},
"jest": {
"preset": "react-native",
"transformIgnorePatterns": [
"/node_modules/(?!native-base)/"
]
},
"rnpm": {
"assets": [
"./assets/fonts"
]
}
}
Issue
I am trying to display images in push notifications on Android when the app is in background. When running in foreground, I see the image in the notification but as soon as the app is in background or even not running, the headless task is not being executed. I can see the notification with text and title but since the headless task is not being executed, the image is not being downloaded and displayed.
I followed the documentation of rnfirebase-(Optional)(Android-only)-Listen-for-FCM-messages-in-the-background) and https://medium.com/@sumedh.tare/react-native-firebase-custom-notification-with-image-d9c2264c7fab
My goal is to see the image when the app is not in foreground too.
We added the following code:
index.android.js
after registering the Main component.
notifications/bgNotifications.js
MainApplication.java
Added this in the
onCreate()functionUnfortunately the headless task is never executed and I never get into the JS part to debug further. That's why I think this may a bug. Any hints are very appreciated on how to fix this.
Project Files
Javascript
Click To Expand
package.json:{ "name": "xxx", "version": "0.0.1", "private": true, "engines": { "node": ">=10.16.0", "npm": ">=6.9.0" }, "scripts": { "start": "react-native start", "test": "jest", "lint": "eslint .", "reset-cache": "npm start -- --reset-cache", "fix": "prettier-eslint --write \"src/**/*.{js,jsx,json,css}\"", "update-i18n": "node ./scripts/update-localizations.js", "postinstall": "npx jetify" }, "dependencies": { "@react-native-community/art": "^1.1.2", "@react-native-community/async-storage": "^1.7.1", "@react-native-community/cameraroll": "^1.3.0", "@react-native-community/datetimepicker": "^2.2.2", "@react-native-community/geolocation": "^2.0.2", "@react-native-community/netinfo": "^5.0.0", "adyen-cse-js": "git+https://github.com/Adyen/adyen-cse-web.git#v0.1.24", "ajv": "^5.5.1", "aws-amplify": "^1.2.4", "eslint-import-resolver-babel-module": "^4.0.0", "fsevents": "^1.2.9", "geolib": "^3.2.0", "instabug-reactnative": "^9.0.1", "jetifier": "^1.6.3", "lodash": "^4.17.15", "moment": "^2.22.2", "moment-timezone": "^0.5.21", "node-libs-browser": "2.1.0", "normalizr": "^3.2.4", "prop-types": "^15.6.1", "qs": "^6.7.0", "querystring": "^0.2.0", "react": "^16.9.0", "react-devtools": "^3.4.3", "react-devtools-core": "^3.4.3", "react-native": "^0.61.5", "react-native-adyen-cse": "^1.0.7", "react-native-amplitude-analytics": "^0.2.7", "react-native-animatable": "^1.3.3", "react-native-background-fetch": "^2.7.1", "react-native-background-geolocation": "^3.4.2", "react-native-branch": "^4.3.0", "react-native-calendar-events": "^1.7.3", "react-native-check-app-install": "0.0.5", "react-native-dark-mode": "^0.2.1", "react-native-datepicker": "^1.6.0", "react-native-device-info": "^5.4.0", "react-native-elements": "^1.2.7", "react-native-extended-stylesheet": "^0.12.0", "react-native-fabric": "git+https://github.com/xxx/react-native-fabric.git#fix/android-warning", "react-native-fast-image": "^7.0.2", "react-native-fbsdk": "~1.0.4", "react-native-firebase": "^5.6.0", "react-native-fs": "^2.16.2", "react-native-geolocation-service": "^3.1.0", "react-native-gesture-handler": "^1.5.2", "react-native-gifted-chat": "git+https://github.com/xxx/react-native-gifted-chat.git#fix/babel-config", "react-native-hyperlink": "0.0.18", "react-native-i18n": "git+https://github.com/xxx/react-native-i18n.git#fix/androidx", "react-native-image-crop-picker": "^0.26.1", "react-native-iphone-x-helper": "^1.2.1", "react-native-keyboard-aware-scroll-view": "^0.9.1", "react-native-keychain": "^4.0.4", "react-native-linear-gradient": "^2.5.6", "react-native-loading-spinner-overlay": "^1.0.1", "react-native-localize": "^1.3.1", "react-native-maps": "^0.26.1", "react-native-masked-text": "^1.13.0", "react-native-offline": "^5.2.0", "react-native-pages": "^0.9.0", "react-native-permissions": "^2.0.9", "react-native-phone-call": "^1.0.9", "react-native-progress": "^4.0.3", "react-native-rate": "^1.1.10", "react-native-read-more-text": "^1.1.0", "react-native-reanimated": "^1.4.0", "react-native-share": "^2.0.0", "react-native-simple-store": "git+https://github.com/xxx/react-native-simple-store.git#master", "react-native-smart-gallery": "^1.1.5", "react-native-snap-carousel": "^3.8.4", "react-native-status-bar-height": "^2.4.0", "react-native-swipe-list-view": "^2.1.3", "react-native-swipeout": "^2.3.6", "react-native-uuid": "^1.4.9", "react-native-v8": "^0.61.5-patch.0", "react-native-vector-icons": "^6.6.0", "react-native-version-check": "^3.3.1", "react-native-version-number": "^0.3.6", "react-native-webview": "^8.0.0", "react-navigation": "^4.0.10", "react-navigation-stack": "^1.10.3", "react-navigation-tabs": "^2.6.2", "react-redux": "7.0.0", "redux": "^4.0.4", "redux-actions": "^2.3.0", "redux-form": "^8.2.5", "redux-thunk": "^2.2.0", "reselect": "^4.0.0", "rmc-picker": "^5.0.10", "rn-fetch-blob": "^0.12.0", "short-uuid": "^3.1.1", "stream": "0.0.2", "vm": "^0.1.0" }, "devDependencies": { "@babel/core": "^7.6.2", "@babel/runtime": "^7.6.2", "@react-native-community/eslint-config": "^0.0.5", "babel-eslint": "^8.2.2", "babel-jest": "^24.9.0", "babel-plugin-module-resolver": "^3.1.0", "babel-plugin-rewrite-require": "^1.14.5", "babel-plugin-transform-inline-environment-variables": "^0.3.0", "eslint": "^6.5.1", "eslint-config-airbnb": "^17.1.1", "eslint-config-prettier": "^6.0.0", "eslint-plugin-import": "^2.18.2", "eslint-plugin-jest": "^22.21.0", "eslint-plugin-jsx-a11y": "^6.0.3", "eslint-plugin-react": "^7.14.3", "eslint-plugin-react-native": "^3.7.0", "firebase-tools": "^7.6.1", "jest": "^24.9.0", "localize-spreadsheet-bot": "^0.8.5", "metro-react-native-babel-preset": "^0.56.0", "prettier-eslint": "^8.8.2", "prettier-eslint-cli": "^4.7.1", "react-test-renderer": "16.9.0", "redux-devtools-extension": "^2.13.2", "remote-redux-devtools": "^0.5.12", "schedule": "^0.4.0" }, "jest": { "preset": "react-native", "transformIgnorePatterns": [ "/node_modules/(?!native-base)/" ] }, "rnpm": { "assets": [ "./assets/fonts" ] } }iOS
Click To Expand
ios/Podfile:# N/AAppDelegate.m:// N/AAndroid
Click To Expand
Have you converted to AndroidX?
android/gradle.settingsjetifier=truefor Android compatibility?jetifierfor react-native compatibility?android/build.gradle:android/app/build.gradle:// N/Aandroid/settings.gradle:// N/AMainApplication.java:// N/AAndroidManifest.xml:Environment
Click To Expand
react-native infooutput:react-native-firebaseversion you're using that has this issue:e.g. 5.4.3Firebasemodule(s) you're using that has the issue:e.g. Instance IDTypeScript?Y/N&VERSIONThink
react-native-firebaseis great? Please consider supporting all of the project maintainers and contributors by donating via our Open Collective where all contributors can submit expenses. [Learn More]React Native FirebaseandInvertaseon Twitter for updates on the library.