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 are not been showing in status bar either localNotificationSchedule or localNotification

See original GitHub issue

Question

Context: I’m using the latest version : 6.1.1 (I’m using Android a physical device) I’m getting the notification correctly, but the notification is not being displayed in status bar, am I missing something ? I have use this library one year ago in another app and it was working straightforward…

onNotification: (notification) =>{ 
console.log('[onNotification] -------------------------->:', notification);
PushNotification.localNotificationSchedule({
          channelId: "Test_Channel",
          title: 'MyApp',
          message: 'You have a new message',
          text: 'testing',
          soundName: 'default',
          date: new Date(Date.now() + 1 * 1000) // in 1 secs
        });
}

here is my manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  package="com.blast">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    <uses-permission
        android:name="android.permission.READ_PHONE_STATE"
        tools:node="remove" />
    <permission
        android:name="${applicationId}.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />
    <uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/SplashTheme"
      >

        <!-- For push notifications -->
        <meta-data  android:name="com.dieam.reactnativepushnotification.notification_channel_name"
                android:value="Test_Channel"/>
        <meta-data  android:name="com.dieam.reactnativepushnotification.notification_channel_description"
                    android:value="Push notifications for Test"/>
        <!-- Change the value to true to enable pop-up for in foreground (remote-only, for local use ignoreInForeground) -->
        <meta-data  android:name="com.dieam.reactnativepushnotification.notification_foreground"
                    android:value="true"/>
        <!-- Change the resource name to your App's accent color - or any other color you want -->
        <meta-data  android:name="com.dieam.reactnativepushnotification.notification_color"
                    android:resource="@android:color/white"/>
        <meta-data android:name="com.google.firebase.messaging.default_notification_icon"
                    android:resource="@drawable/ic_notification" />

        <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"/>

        <!-- < Only if you're using GCM or localNotificationSchedule() > -->
        <service
            android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerServiceGcm"
            android:exported="false" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            </intent-filter>
        </service>
        <!-- </ Only if you're using GCM or localNotificationSchedule() > -->

        <!-- < Else > -->
        <service
            android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
            android:exported="false" >
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>

      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <service android:name=".Notifications.MessagingNotificationAndroidIntentService" />
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
      <activity android:name="com.facebook.flipper.android.diagnostics.FlipperDiagnosticActivity"
          android:exported="true"/>
    </application>

</manifest>

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
Dallas62commented, Oct 15, 2020

Hi,

For icons, there is other issues about it. (Can’t link from my phone). Vibration might not works well on recent devices, a PR is opened and I will check it ASAP. Sounds should be ok, did you set the sound on the channel ?

0reactions
github-actions[bot]commented, Oct 16, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Schedule local notifications in react native not working
I was able to receive localNotification but it was only scheduled notifications those were not being received. Share.
Read more >
flutter_local_notifications | Flutter Package - Pub.dev
A cross platform plugin for displaying and scheduling local notifications for Flutter applications with the ability to customise for each platform.
Read more >
Notifications - Expo Documentation
When a notification is received while the app is running, using this function you can set a callback that will decide whether the...
Read more >
Local Notifications Capacitor Plugin API
The Local Notifications API provides a way to schedule device notifications locally (i.e. without a server sending push notifications).
Read more >
Local Notifications: Getting Started - RayWenderlich.com
Notifications can be either local or remote. ... notification's behavior, such as displaying an alert, playing a sound or updating the app's ...
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