Hi,
when my app (android) is on background I cannot see the notification on the notification bar, but I can see the notification on the console and on my simulator I have

I'm using
react-native: 0.55.4
minSdkVersion 16
targetSdkVersion 26
and
com.google.gms:google-services:4.0.1.
I don't want to downgrade to targetSdkVersion 25 since, as Google says from August 2018 for new apps and November for app updates, you will be required to target Android O (API level 26)
I have the same problem.... since I had installed the react-native-fcm.
Can anyone help us?
I am also having this problem but i cannot see notification in any case, it just shows this error notification.
@manuTro can you share your code..
@xainbutt my code is in clojurescript.. however here it is
(defonce app-root
(r/create-class
{:component-will-mount
(fn []
(let [width (aget (.get Dimensions "window") "width")]
(dispatch [:width-scale width])
(.configure PushNot
#js {:onNotification (fn [notification]
(println "notification: " notification))
:onRegister (fn [token] (println "token-notification" token) (reset! tok token)
(dispatch [:token-notification (.-token token)])
(dispatch [:os (.-os token)]))
:senderID "......"
:requestPermissions true
:permissions #js {:alert true
:badge true
:sound true}})))
:reagent-render
(fn [] .......)}))
Can you try with the last git version of this package ?
Normally Oreo is now supported (using the code from this repo and not npm). We will have to upload a new release to npm.
@Gp2mv3 I tried but I got this error
````
Task :react-native-push-notification:compileDebugJavaWithJavac FAILED
/Users/manuela/Desktop/robonica/roboapp/tmp/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java:7: error: cannot find symbol
import android.app.NotificationChannel;
^
symbol: class NotificationChannel
location: package android.app
/Users/manuela/Desktop/robonica/roboapp/tmp/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java:162: error: constructor Builder in class Builder cannot be applied to given types;
NotificationCompat.Builder notification = new NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID)
^
required: Context
found: Context,String
reason: actual and formal argument lists differ in length
/Users/manuela/Desktop/robonica/roboapp/tmp/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java:480: error: cannot find symbol
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O)
^
symbol: variable O
location: class VERSION_CODES
/Users/manuela/Desktop/robonica/roboapp/tmp/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java:488: error: cannot find symbol
int importance = NotificationManager.IMPORTANCE_DEFAULT;
^
symbol: variable IMPORTANCE_DEFAULT
location: class NotificationManager
/Users/manuela/Desktop/robonica/roboapp/tmp/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java:489: error: cannot find symbol
NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, name, importance);
^
symbol: class NotificationChannel
location: class RNPushNotificationHelper
/Users/manuela/Desktop/robonica/roboapp/tmp/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java:489: error: cannot find symbol
NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, name, importance);
^
symbol: class NotificationChannel
location: class RNPushNotificationHelper
Note: /Users/manuela/Desktop/robonica/roboapp/tmp/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/helpers/ApplicationBadgeHelper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
6 errors
FAILURE: Build failed with an exception.```
@Gp2mv3 I solved this error (and another one after this) by upgrading on react-native-push-notification/android/build.gradle this dependencies
def DEFAULT_COMPILE_SDK_VERSION = 26
def DEFAULT_BUILD_TOOLS_VERSION = "26.1.0"
def DEFAULT_TARGET_SDK_VERSION = 23
def DEFAULT_SUPPORT_LIB_VERSION = "26.1.0"
def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION = "+"
def DEFAULT_FIREBASE_MESSAGING_VERSION = "+"
Now It is working fine on Android Oreo. I'll test if it works on Android 7
@Gp2mv3 I've just tried with Android 7 and notification are not coming at all..
@manuTro I have yours same issue, can you share your build.gradle dependecies? thanks a lot
I'm sorry, I meant this file: react-native-push-notification/android/build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.library'
def DEFAULT_COMPILE_SDK_VERSION = 26
def DEFAULT_BUILD_TOOLS_VERSION = "26.0.1"
def DEFAULT_TARGET_SDK_VERSION = 23
def DEFAULT_SUPPORT_LIB_VERSION = "26.1.0"
def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION = "+"
def DEFAULT_FIREBASE_MESSAGING_VERSION = "+"
android {
compileSdkVersion project.hasProperty('compileSdkVersion') ? project.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
buildToolsVersion project.hasProperty('buildToolsVersion') ? project.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
defaultConfig {
minSdkVersion 16
targetSdkVersion project.hasProperty('targetSdkVersion') ? project.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
def supportLibVersion = project.hasProperty('supportLibVersion') ? project.supportLibVersion : DEFAULT_SUPPORT_LIB_VERSION
def googlePlayServicesVersion = project.hasProperty('googlePlayServicesVersion') ? project.googlePlayServicesVersion : DEFAULT_GOOGLE_PLAY_SERVICES_VERSION
def firebaseVersion = project.hasProperty('firebaseVersion') ? project.firebaseVersion : DEFAULT_FIREBASE_MESSAGING_VERSION
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile "com.android.support:appcompat-v7:$supportLibVersion"
compile 'com.facebook.react:react-native:+'
compile "com.google.android.gms:play-services-gcm:$googlePlayServicesVersion"
compile 'me.leolin:ShortcutBadger:1.1.8@aar'
compile "com.google.firebase:firebase-messaging:$firebaseVersion"
}
With this changes it works with oreo but not with previous versions..
@Vincenzo1997 did you find a solution?
Not yet , I'm able to make It work in Oreo 8.0, but not for previous sdk
Il ven 20 lug 2018, 14:28 manuTro notifications@github.com ha scritto:
@Vincenzo1997 https://github.com/Vincenzo1997 did you find a solution?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/zo0r/react-native-push-notification/issues/794#issuecomment-406586068,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AgsMeBKj5ZQvRIpF8BltyhK05H0AeFw3ks5uIczZgaJpZM4VRYo2
.
Can you try with the example app ? I did it with Android 7.1.2 and it works perfectly. Same on Android 8.
Probably this is the problem
link: https://developer.android.com/guide/topics/ui/notifiers/notifications

Normally, using the npm package from the git repo, it's corrected. We are just waiting for an npm update.
It's working. I tried again by importing the library writing on my package.json
"react-native-push-notification": "https://github.com/Dhanraj-bidchat/react-native-push-notification.git" (before I was just cloning the last repository on my node_modules.. I thought it was the same.. ) and by adding on my build.gradle
ext {
googlePlayServicesVersion = "4.0.1" // default: "+"
firebaseVersion = "+" // default: "+"
// Other settings
compileSdkVersion = 27 // default: 23
buildToolsVersion = "23.0.1"
targetSdkVersion = 26 // default: 23
supportLibVersion = "26.1.0" // default: 23.1.1
Now It is all working fine. I tested it on Android 8 and Android 7. Thanks @Gp2mv3 !
following error come when i rebuild project
error: cannot find symbol class NotificationChannel
error: cannot find symbol variable O
My gradle file
def enableSeparateBuildPerCPUArchitecture = false
/**
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.salesplusnew"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a": 1, "x86": 2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
productFlavors {
}
}
def DEFAULT_COMPILE_SDK_VERSION = 27
def DEFAULT_BUILD_TOOLS_VERSION = "27.0.3"
def DEFAULT_TARGET_SDK_VERSION = 27
def DEFAULT_SUPPORT_LIB_VERSION = "27.0.3"
def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION = "+"
def DEFAULT_FIREBASE_MESSAGING_VERSION = "+"
dependencies {
def supportLibVersion = project.hasProperty('supportLibVersion') ? project.supportLibVersion : DEFAULT_SUPPORT_LIB_VERSION
def googlePlayServicesVersion = project.hasProperty('googlePlayServicesVersion') ? project.googlePlayServicesVersion : DEFAULT_GOOGLE_PLAY_SERVICES_VERSION
def firebaseVersion = project.hasProperty('firebaseVersion') ? project.firebaseVersion : DEFAULT_FIREBASE_MESSAGING_VERSION
testCompile 'junit:junit:4.12'
// compile "com.android.support:appcompat-v7:$supportLibVersion"
compile "com.google.android.gms:play-services-gcm:$googlePlayServicesVersion"
compile 'me.leolin:ShortcutBadger:1.1.8@aar'
compile "com.google.firebase:firebase-messaging:$firebaseVersion"
compile project(':react-native-push-notification')
compile project(':react-native-touch-id')
compile project(':react-native-keychain')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.facebook.react:react-native:+'
// From node_modules
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
this is not work
Most helpful comment
It's working. I tried again by importing the library writing on my package.json
"react-native-push-notification": "https://github.com/Dhanraj-bidchat/react-native-push-notification.git"(before I was just cloning the last repository on my node_modules.. I thought it was the same.. ) and by adding on mybuild.gradleNow It is all working fine. I tested it on Android 8 and Android 7. Thanks @Gp2mv3 !