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.

App crashing on PushNotification.configure() -Android

See original GitHub issue

I have configure the package as per the installation docs. As soon as I call PushNotification.configure() in componentDidMount(). The app crashes immediately.

PushNotification.configure({
      
      // (optional) Called when Token is generated (iOS and Android)
      onRegister: (token) => {
        this.props.dispatch(saveDeviceToken(token));
        console.log('TOKEN:', token);
      },

      // (required) Called when a remote or local notification is opened or received
      onNotification: (notification) => {
        console.log('NOTIFICATION:', notification);
      },

      // ANDROID ONLY: GCM Sender ID (optional - not required for local notifications, but is need to receive remote push notifications)
      senderID: '422724865895',

      // Should the initial notification be popped automatically
      // default: true
      popInitialNotification: true,

      requestPermissions: true,
    });

“react-native-push-notification”: “^3.0.2”, “react-native”: “0.53.3”, “react”: “16.2.0”

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
quynhnguyen68commented, Dec 18, 2018

I also got app crashing but when receiving notification

FATAL EXCEPTION: main
    Process: com.online2study.mobile, PID: 31428
    android.app.RemoteServiceException: Bad notification posted from package com.online2study.mobile: Couldn't create icon: StatusBarIcon(icon=Icon(typ=RESOURCE pkg=com.online2study.mobile id=0x7f030001) visible user=0 )
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1775)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6541)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Anyone know how to fix this? Thank you

0reactions
gczudowskicommented, Jun 4, 2022

Same issue here. Has anyone solved it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android app crashes when push notification is coming
From the logs: calling HauptActivity.changeMeldungGefahr(HauptActivity.java:221) leads to a null pointer. You should fix the Nullpointer ...
Read more >
2.8.31 - Crash when opening a push notification and app not ...
I'm seeing a crash on app startup after opening a push notification. It only seems to happen when the app is not running...
Read more >
App crash on startup when enable push notifications
Hello :slight_smile: I try to implement push notifications to my app but it won't work. I started with the android version, and that...
Read more >
Developers - App crashing on PushNotification.configure() -Android -
I have configure the package as per the installation docs. As soon as I call PushNotification.configure() in componentDidMount(). The app crashes ...
Read more >
Xamarin Forms Push Notification Integration App Crash (iOS)
1. There is no problem in implementation in android project. But the application crashes after the splash screen appears in the ios project....
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