Closed LamJingJie closed 3 years ago
Thanks for the detailed information, I'm going to investigate this ASAP :)
Did you add LocalNotificationExtension plugin class to your MainActivity plugin list?
This plugin has some boilerplates to do for android before applying.
Check that you have to add both NotificationExtension and LocalNotificationExtension to your main activity.
And I also recommend the second method that you used, the first one will cause the same error on iOS.
Hi this is my first post so, if there is any thing I am missing do inform me :)
I am pretty new to programming in general and I am currently building an app to receive local notifications in my application. Just a simple local notification scheduling and when the time comes it will be send to the user device in which it the 'localNotificationReceived' will catch it and then run the necessary codes.
I am using Ionic 5 React with Capacitor
However, as you can see in my codes below I have tried 2 methods but to no avail. I kept giving me this error whenever I try to run it on my device.
Any help will be greatly appreciated :)
App info Ionic:
Ionic CLI : 6.13.1 Ionic Framework : @ionic/react 5.6.0
Capacitor:
Capacitor CLI : 2.4.7 @capacitor/core : 2.4.7
Utility:
cordova-res : 0.15.3 native-run : 1.3.0
System:
NodeJS : v15.4.0 (C:\Program Files\nodejs\node.exe) npm : 7.0.15 OS : Windows 10
Codes
Error when tried to run on physical device
E/Capacitor/Console: File: http://localhost/static/js/4.3d51a168.chunk.js - Line 2 - Msg: TypeError: Cannot read property 'addListener' of undefined E/Capacitor: JavaScript Error: {"type":"js.error","error":{"message":"Uncaught TypeError: Cannot read property 'addListener' of undefined","url":"http://localhost/static/js/4.3d51a168.chunk.js","line":2,"col":589652,"errorObject":"{}"}} E/Capacitor/Console: File: capacitor-runtime.js - Line 359 - Msg: TypeError: Cannot read property 'addListener' of undefined E/Capacitor/Console: File: http://localhost/static/js/4.3d51a168.chunk.js - Line 2 - Msg: Uncaught TypeError: Cannot read property 'addListener' of undefined