Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Could not invoke RNPushNotification.getDeliveredNotifications #1878

Closed
darknessproduction opened this issue Feb 19, 2021 · 11 comments
Closed

Comments

@darknessproduction
Copy link

darknessproduction commented Feb 19, 2021

Hello guys. We use remote push notifications. After use tapped on notification, we need to remove it. Everything works fine on real device when I build release and install it on device but when I upload my build to Google Play Console, after review it shows this:
Crash java.lang.RuntimeException: Could not invoke RNPushNotification.getDeliveredNotifications

https://clip2net.com/clip/m354799/71e28-clip-167kb.png?nocache=1

@zo0r do you know what can cause this issue?

@darknessproduction
Copy link
Author

darknessproduction commented Feb 19, 2021

import PushNotification from "react-native-push-notification"
componentDidMount(){
  PushNotification.getDeliveredNotifications((data) => {
	  data.map((notify, key) => {
		  if(Platform.OS == 'android'){
			  PushNotification.removeAllDeliveredNotifications({id: notify.tag});
		  }
	  })
  })	
}

@darknessproduction
Copy link
Author

How can I fix this or get rid of it?

@gavrilin-remote
Copy link

gavrilin-remote commented Mar 4, 2021

Hi! Have the same problem.
Any updates?

@darknessproduction
Copy link
Author

I just removed this code and its fine but we dont remove push notifications now hahaha
Can you guys help us please?
@Dallas62 @zo0r

@darknessproduction
Copy link
Author

Feel like this library not supported anymore gg

@Dallas62
Copy link
Collaborator

Dallas62 commented Mar 4, 2021

Hi @darknessproduction
Can you share the full StackTrace? I'm not going to tape the whole error from a picture.
Regards,

@darknessproduction
Copy link
Author

You're awesome.
@Dallas62 @zo0r
Look at this full logcat
https://sarzhevsky.com/rnpn.txt

@darknessproduction
Copy link
Author

darknessproduction commented Mar 4, 2021

And this is what triggered the error that you've seen in the screenshot
FATAL EXCEPTION: mqt_native_modules Process: com.swattage.tribe, PID: 28197 java.lang.RuntimeException: Could not invoke RNPushNotification.getDeliveredNotifications at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:383) at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:151) at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27) at android.os.Looper.loop(Looper.java:135) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226) at java.lang.Thread.run(Thread.java:831) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372) ... 8 more Caused by: java.lang.NoSuchMethodError: No virtual method getActiveNotifications()[Landroid/service/notification/StatusBarNotification; in class Landroid/app/NotificationManager; or its super classes (declaration of 'android.app.NotificationManager' appears in /system/framework/framework.jar) at com.dieam.reactnativepushnotification.modules.RNPushNotificationHelper.getDeliveredNotifications(RNPushNotificationHelper.java:684) at com.dieam.reactnativepushnotification.modules.RNPushNotification.getDeliveredNotifications(RNPushNotification.java:239) ... 11 more

@Dallas62
Copy link
Collaborator

Dallas62 commented Mar 4, 2021

It's an issue with the SDK version with this line:
https://github.com/zo0r/react-native-push-notification/blob/master/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java#L727

I'm going to publish a fix ASAP.
Then you will be able to use the code you published but it will not work for Android SDK < 23 (Android M).

Regards,

@Dallas62
Copy link
Collaborator

Dallas62 commented Mar 4, 2021

Version 7.2.2 is now released.
https://github.com/zo0r/react-native-push-notification/releases/tag/7.2.2
Regards

@darknessproduction
Copy link
Author

Damn it. You're amazing man.
@Dallas62

elburu pushed a commit to elburu/react-native-push-notification that referenced this issue Mar 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants