question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Notifications on Android, not working, but iOS working..

See original GitHub issue

Hello, sorry my english i am french.

I have switch firebase to “react-native-push-notification” when firebase update V6 version, so… i have try fresh install react-native and add package “react-native-push-notification”, on iOS work perfectly but android, don’t work and no error on build. After 2 days work on this i publish issue for help me !

I have try APK and publish on Play Store for try receive notifications…

On main.js (react-native) :

PushNotification.configure({
       onRegister: function(token) {
         console.log("TOKEN:", token)
       },
       onNotification: function(notification) {
         console.log("REMOTE NOTIFICATION ==>", notification)
       },
       senderID: "310638074945",
       popInitialNotification: true,
       requestPermissions: true
})

On AndroidManifest.xml :

<meta-data  android:name="com.dieam.reactnativepushnotification.notification_channel_name"
            android:value="Reception des notifications"/>
        <meta-data  android:name="com.dieam.reactnativepushnotification.notification_channel_description"
            android:value="Reception général de toutes les notifications liés à lapplication"/>
        <meta-data  android:name="com.dieam.reactnativepushnotification.notification_color"
            android:resource="@android:color/white"/>
        <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
        <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>
        <service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationRegistrationService"/>
        <service
            android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
            android:exported="false" >
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>

colors.xml :

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="white">#FFF</color>
</resources>

build.gradle :

buildscript {
    ext {
        googlePlayServicesVersion = "+"
        firebaseVersion = "+"
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.2")
        classpath("com.google.gms:google-services:4.2.0")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

settings.gradle :

include ':react-native-push-notification'
project(':react-native-push-notification').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-push-notification/android')

app/build.gradle :

implementation project(':react-native-push-notification')
apply plugin: 'com.google.gms.google-services'

MainApplication.java :

import com.dieam.reactnativepushnotification.ReactNativePushNotificationPackage;
.....
protected List<ReactPackage> getPackages() {
          @SuppressWarnings("UnnecessaryLocalVariable")
          List<ReactPackage> packages = new PackageList(this).getPackages();
          // Packages that cannot be autolinked yet can be added manually here, for example:
          new VectorIconsPackage();
          new ReactNativePushNotificationPackage();
          new RNVersionNumberPackage();
          new RNDeviceInfo();
          return packages;
        }

if you see my error… tell me please 😒

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
Linrasiscommented, Jan 13, 2020

I found my real problem, when getToken firebase, is not same getToken onRegister: function(token) function, but firebase for iOS is good.

0reactions
jf-ouellettecommented, Jan 30, 2020

@Linrasis Merci! Finalement j’ai décidé d’utiliser react-native-firebase v5

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Notifications Not Showing Up? 10 Fixes You Can Try
Android Notifications Not Showing Up? 10 Fixes You Can Try · 1. Reboot Your Phone · 2. Review the App's Notification Settings ·...
Read more >
How to Fix Notifications Not Showing up on Android - Lifewire
Restart your phone · Make sure you haven't disabled system notifications · Make sure you haven't turned off app notifications · Check your...
Read more >
Android Notifications Not Working [ 2022 Ultimate Fixes]
1Why Are My Notifications Not Showing Up on Android? · Check if the Do Not Disturb mode is enabled. · Check if battery...
Read more >
Top 8 Ways to Fix Notifications Not Working on iPhone
Top 8 Ways to Fix Notifications Not Working on iPhone · 1. Restart iPhone · 2. Disable Focus Mode · 3. Disable Scheduled...
Read more >
Notifications Not Shown - Mobile Push
Common reasons why Mobile Push notifications are not showing on your device. ... Android,iOS: In your Device Settings > Notifications > Your App, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found